Last change
on this file since 3129 was
3129,
checked in by mylan, 13 years ago
|
Initial import of the package
|
-
Property svn:eol-style set to
native
|
File size:
906 bytes
|
Line | |
---|
1 | from Products.CMFCore.utils import getToolByName |
---|
2 | from Products.Five.browser.pagetemplatefile import ViewPageTemplateFile |
---|
3 | from plone.app.layout.viewlets import common |
---|
4 | |
---|
5 | from ploneorg.kudobounty.config import TOPIC_PATH |
---|
6 | |
---|
7 | # -*- extra stuff goes here -*- |
---|
8 | |
---|
9 | class BountyViewlet(common.ViewletBase): |
---|
10 | render = ViewPageTemplateFile('bounty_viewlet.pt') |
---|
11 | |
---|
12 | def topic(self): |
---|
13 | try: |
---|
14 | return self.portal_state.portal().restrictedTraverse(TOPIC_PATH) |
---|
15 | except KeyError: |
---|
16 | return None |
---|
17 | |
---|
18 | def available(self): |
---|
19 | return bool(self.topic()) |
---|
20 | |
---|
21 | def bounty_submissions(self): |
---|
22 | #import pdb;pdb.set_trace() |
---|
23 | query = self.topic().queryCatalog() |
---|
24 | res = [{'url':b.getRemoteUrl, |
---|
25 | 'title': b.Title, |
---|
26 | 'alt': b.Description, |
---|
27 | 'img_url': "%s/image_bounty" % b.getURL()} \ |
---|
28 | for b in query] |
---|
29 | return res |
---|
Note: See
TracBrowser
for help on using the repository browser.