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

Last change on this file since 1039 was 1039, checked in by koval, 15 years ago

fixed bug with non-ascii characters in tags

File size: 876 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 getTags(self, number=None):
13        """ Get Quills blog's tags.
14        """
15        weblog = self.getWeblog()
16        if weblog == []:
17            return super(QuillsBlogTags, self).getTags(number)
18
19        topics = weblog.getTopics()
20        tags = []
21        for topic in topics:
22            tags.append((topic.getTitle().decode(self.default_charset), len(topic), topic.absolute_url()))
23
24        return tags
25
26    def getWeblog(self):
27        locator = IWeblogLocator(self.context)
28        weblog = locator.find()
29        return weblog
Note: See TracBrowser for help on using the repository browser.