Last change
on this file since 1038 was
1036,
checked in by koval, 15 years ago
|
retrieving of tags moved from portlet renderer to adapters and added Quills support
|
File size:
912 bytes
|
Line | |
---|
1 | from zope.interface import implements |
---|
2 | from Products.CMFCore.utils import getToolByName |
---|
3 | |
---|
4 | from quills.core.interfaces import IWeblogLocator |
---|
5 | |
---|
6 | from quintagroup.portlet.cumulus.interfaces import ITagsRetriever |
---|
7 | from quintagroup.portlet.cumulus.catalog import GlobalTags |
---|
8 | |
---|
9 | class QuillsBlogTags(GlobalTags): |
---|
10 | implements(ITagsRetriever) |
---|
11 | |
---|
12 | def __init__(self, context): |
---|
13 | self.context = context |
---|
14 | |
---|
15 | def getTags(self, number=None): |
---|
16 | """ Get Quills blog's tags. |
---|
17 | """ |
---|
18 | weblog = self.getWeblog() |
---|
19 | if weblog == []: |
---|
20 | return super(QuillsBlogTags, self).getTags(number) |
---|
21 | |
---|
22 | topics = weblog.getTopics() |
---|
23 | tags = [] |
---|
24 | for topic in topics: |
---|
25 | tags.append((topic.getTitle(), len(topic), topic.absolute_url())) |
---|
26 | |
---|
27 | return tags |
---|
28 | |
---|
29 | def getWeblog(self): |
---|
30 | locator = IWeblogLocator(self.context) |
---|
31 | weblog = locator.find() |
---|
32 | return weblog |
---|
Note: See
TracBrowser
for help on using the repository browser.