Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(1993)

Delta Between Two Patch Sets: MoinMoin/items/ticket.py

Issue 10889044: Rough TicketIndex implementation
Left Patch Set: remove an unused import Created 11 years, 9 months ago
Right Patch Set: put display_fields.py under a new schema package Created 11 years, 8 months ago
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
Left: Side by side diff | Download
Right: Side by side diff | Download
« no previous file with change/comment | « MoinMoin/constants/display_widgets.py ('k') | MoinMoin/schema/__init__.py » ('j') | no next file with change/comment »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
LEFTRIGHT
1 # Copyright: 2012 MoinMoin:CheerXiao 1 # Copyright: 2012 MoinMoin:CheerXiao
2 # License: GNU GPL v2 (or any later version), see LICENSE.txt for details. 2 # License: GNU GPL v2 (or any later version), see LICENSE.txt for details.
3 3
4 """ 4 """
5 MoinMoin - Ticket itemtype 5 MoinMoin - Ticket itemtype
6 """ 6 """
7 7
8 8
9 from __future__ import absolute_import, division 9 from __future__ import absolute_import, division
10 10
11 import time 11 import time
12 12
13 from flask import request, abort, redirect, url_for 13 from flask import request, abort, redirect, url_for
14 from flask import g as flaskg 14 from flask import g as flaskg
15 from flask import current_app as app 15 from flask import current_app as app
16 16
17 from jinja2 import Markup 17 from jinja2 import Markup
18 18
19 from whoosh.query import Term, Prefix 19 from whoosh.query import Term, Prefix
20 20
21 from MoinMoin.i18n import L_ 21 from MoinMoin.i18n import L_
22 from MoinMoin.themes import render_template 22 from MoinMoin.themes import render_template
23 from MoinMoin.forms import (Form, OptionalText, OptionalMultilineText, SmallNatu ral, Tags, 23 from MoinMoin.forms import (Form, OptionalText, OptionalMultilineText, SmallNatu ral, Tags,
24 Reference, BackReference, SelectSubmit) 24 Reference, BackReference, SelectSubmit)
25 from MoinMoin.storage.middleware.protecting import AccessDenied 25 from MoinMoin.storage.middleware.protecting import AccessDenied
26 from MoinMoin.constants.keys import ITEMTYPE, CONTENTTYPE, ITEMID, CURRENT, SUPE RSEDED_BY, DEPENDS_ON, SUBSCRIBED_ITEMS, WIKINAME, NAME, NAME_EXACT 26 from MoinMoin.constants.keys import ITEMTYPE, CONTENTTYPE, ITEMID, CURRENT, SUPE RSEDED_BY, DEPENDS_ON, SUBSCRIBED_ITEMS, WIKINAME, NAME, NAME_EXACT
27 from MoinMoin.constants.contenttypes import CONTENTTYPE_USER 27 from MoinMoin.constants.contenttypes import CONTENTTYPE_USER
28 from MoinMoin.items import Item, Contentful, register, BaseModifyForm, Default, IndexEntry 28 from MoinMoin.items import Item, Contentful, register, BaseModifyForm, Default, IndexEntry
29 from MoinMoin.items.content import NonExistentContent 29 from MoinMoin.items.content import NonExistentContent
30 from MoinMoin.display_field import DisplayField 30 from MoinMoin.schema.display import DisplayField
Thomas.J.Waldmann 2013/07/19 21:13:13 maybe don't put it into the toplevel package
31 from MoinMoin.constants.display_widgets import DISPLAY_PLAIN, DISPLAY_TAGS, DISP LAY_REFERENCE 31 from MoinMoin.constants.display_widgets import DISPLAY_PLAIN, DISPLAY_TAGS, DISP LAY_REFERENCE
32 32
33 33
34 ITEMTYPE_TICKET = u'ticket' 34 ITEMTYPE_TICKET = u'ticket'
35 35
36 USER_QUERY = Term(CONTENTTYPE, CONTENTTYPE_USER) 36 USER_QUERY = Term(CONTENTTYPE, CONTENTTYPE_USER)
37 TICKET_QUERY = Term(ITEMTYPE, ITEMTYPE_TICKET) 37 TICKET_QUERY = Term(ITEMTYPE, ITEMTYPE_TICKET)
38 38
39 Rating = SmallNatural.using(optional=True).with_properties(lower=1, upper=5) 39 Rating = SmallNatural.using(optional=True).with_properties(lower=1, upper=5)
40 OptionalTicketReference = Reference.to(TICKET_QUERY).using(optional=True) 40 OptionalTicketReference = Reference.to(TICKET_QUERY).using(optional=True)
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after
216 for rev in revs: 216 for rev in revs:
217 fullname = rev.meta[NAME][0] 217 fullname = rev.meta[NAME][0]
218 relname = fullname[prefixlen:] 218 relname = fullname[prefixlen:]
219 tickets.append(IndexEntry(relname, fullname, rev.meta)) 219 tickets.append(IndexEntry(relname, fullname, rev.meta))
220 return render_template(self.show_template, 220 return render_template(self.show_template,
221 item_name=self.name, 221 item_name=self.name,
222 data_rendered=Markup(self.content._render_data()) , 222 data_rendered=Markup(self.content._render_data()) ,
223 fields=display_fields, 223 fields=display_fields,
224 tickets=tickets 224 tickets=tickets
225 ) 225 )
LEFTRIGHT

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b