source: products/quintagroup.portlet.cumulus/trunk/quintagroup/portlet/cumulus/blog.py @ 1038

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 
1from zope.interface import implements
2from Products.CMFCore.utils import getToolByName
3
4from quills.core.interfaces import IWeblogLocator
5
6from quintagroup.portlet.cumulus.interfaces import ITagsRetriever
7from quintagroup.portlet.cumulus.catalog import GlobalTags
8
9class 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.