1 | # -*- coding: utf-8 -*- |
---|
2 | from Products.Five.browser.pagetemplatefile import ViewPageTemplateFile |
---|
3 | from Products.CMFCore.utils import getToolByName |
---|
4 | |
---|
5 | from quills.app.portlets.authors import Renderer as AuthorBaseRenderer |
---|
6 | from quills.app.portlets.recentcomments import Renderer as RecentCommentsBaseRenderer |
---|
7 | from quills.app.portlets.recententries import Renderer as RecentEntriesBaseRenderer |
---|
8 | from quills.app.portlets.quillslinks import Renderer as QuillsLinksBaseRenderer |
---|
9 | |
---|
10 | |
---|
11 | class AuthorRenderer(AuthorBaseRenderer): |
---|
12 | |
---|
13 | _template = ViewPageTemplateFile('authors.pt') |
---|
14 | |
---|
15 | class RecentCommentsRenderer(RecentCommentsBaseRenderer): |
---|
16 | |
---|
17 | _template = ViewPageTemplateFile('recentcomments.pt') |
---|
18 | |
---|
19 | @property |
---|
20 | def getComments(self): |
---|
21 | weblog_content = self.getWeblogContentObject() |
---|
22 | if weblog_content is None: |
---|
23 | return [] |
---|
24 | |
---|
25 | context = self.context.aq_inner |
---|
26 | pc = getToolByName(context, 'portal_catalog') |
---|
27 | comment_brains = pc({ |
---|
28 | 'portal_type' : 'Discussion Item', |
---|
29 | 'sort_on' : 'modified', |
---|
30 | 'sort_order' : 'reverse', |
---|
31 | 'path' : {'query' : '/'.join(context.getPhysicalPath()),} |
---|
32 | }) |
---|
33 | return comment_brains[:self.data.max_comments] |
---|
34 | |
---|
35 | class RecentEntriesRenderer(RecentEntriesBaseRenderer): |
---|
36 | |
---|
37 | _template = ViewPageTemplateFile('weblogrecententries.pt') |
---|
38 | |
---|
39 | class QuillsLinksRenderer(QuillsLinksBaseRenderer): |
---|
40 | |
---|
41 | _template = ViewPageTemplateFile('quillslinks.pt') |
---|