Last change
on this file since 1443 was
1443,
checked in by koval, 14 years ago
|
manually merged fix to ticket #116 from branch
|
File size:
1.1 KB
|
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 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 | title = topic.getTitle() |
---|
23 | # Before this issue http://plone.org/products/quills/issues/209 in |
---|
24 | # Quills was fixed, topic title was not a unicode string |
---|
25 | if not isinstance(title, unicode): |
---|
26 | title = title.decode(self.default_charset) |
---|
27 | tags.append((title, len(topic), topic.absolute_url())) |
---|
28 | |
---|
29 | return tags |
---|
30 | |
---|
31 | def getWeblog(self): |
---|
32 | locator = IWeblogLocator(self.context) |
---|
33 | weblog = locator.find() |
---|
34 | return weblog |
---|
Note: See
TracBrowser
for help on using the repository browser.