comparison MoinMoin/items/ticket.py @ 2713:c9baa61473a9

Now only tags specific to ticket items are shown in +tickets view and in ticket submit/modify view, added a function that returns itemtype specific tags
author Saurabh Kathpalia <saurabh.kathpalia95@gmail.com>
date Sun, 10 Aug 2014 01:59:26 +0530
parents c05ad337ac22
children 8bdd34c2cb74
comparison
equal deleted inserted replaced
2712:61c91995f121 2713:c9baa61473a9
23 Reference, BackReference, SelectSubmit, Text) 23 Reference, BackReference, SelectSubmit, Text)
24 from MoinMoin.storage.middleware.protecting import AccessDenied 24 from MoinMoin.storage.middleware.protecting import AccessDenied
25 from MoinMoin.constants.keys import (ITEMTYPE, CONTENTTYPE, ITEMID, CURRENT, 25 from MoinMoin.constants.keys import (ITEMTYPE, CONTENTTYPE, ITEMID, CURRENT,
26 SUPERSEDED_BY, SUBSCRIPTIONS, DEPENDS_ON, NAME, SUMMARY) 26 SUPERSEDED_BY, SUBSCRIPTIONS, DEPENDS_ON, NAME, SUMMARY)
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 28 from MoinMoin.items import Item, Contentful, register, BaseModifyForm, get_itemtype_specific_tags
29 from MoinMoin.items.content import NonExistentContent 29 from MoinMoin.items.content import NonExistentContent
30 from MoinMoin.constants.keys import LATEST_REVS, TAGS
31 30
32 31
33 ITEMTYPE_TICKET = u'ticket' 32 ITEMTYPE_TICKET = u'ticket'
34 33
35 USER_QUERY = Term(CONTENTTYPE, CONTENTTYPE_USER) 34 USER_QUERY = Term(CONTENTTYPE, CONTENTTYPE_USER)
192 else: 191 else:
193 return redirect(url_for('.show_item', item_name=self.name)) 192 return redirect(url_for('.show_item', item_name=self.name))
194 193
195 # XXX When creating new item, suppress the "foo doesn't exist. Create it?" dummy content 194 # XXX When creating new item, suppress the "foo doesn't exist. Create it?" dummy content
196 data_rendered = None if is_new else Markup(self.content._render_data()) 195 data_rendered = None if is_new else Markup(self.content._render_data())
197 with flaskg.storage.indexer.ix[LATEST_REVS].searcher() as searcher: 196
198 suggested_tags = list(searcher.field_terms(TAGS)) 197 suggested_tags = get_itemtype_specific_tags(ITEMTYPE_TICKET)
199 198
200 return render_template(self.submit_template if is_new else self.modify_template, 199 return render_template(self.submit_template if is_new else self.modify_template,
201 is_new=is_new, 200 is_new=is_new,
202 closed=closed, 201 closed=closed,
203 item_name=self.name, 202 item_name=self.name,
204 data_rendered=data_rendered, 203 data_rendered=data_rendered,
205 form=form, 204 form=form,
206 suggested_tags=suggested_tags, 205 suggested_tags=suggested_tags,
207 item=self, 206 item=self,
208 ) 207 )