source: products/quintagroup.quills.extras/trunk/quintagroup/quills/extras/adapters.py @ 1239

Last change on this file since 1239 was 979, checked in by deo, 17 years ago

Set additional keywords: use both the keywords from the content and all matching keywords.

  • Property svn:eol-style set to native
File size: 1.4 KB
Line 
1from zope.interface import implements
2
3from quills.core.interfaces import IWeblogEntry
4from quills.core.interfaces.enabled import IPossibleWeblogEntry
5from quills.app.utilities import getArchivePathFor, getArchivePathFor
6
7from Products.CMFCore.utils import getToolByName
8
9from Products.fatsyndication.adapters.feedentry import DocumentFeedEntry as BaseFeedEntry
10
11class quillsCanonicalPathAdapter(object):
12    """Adapts quills entry content to canonical path.
13    """
14    def __init__(self, context):
15        self.context = context
16
17    def canonical_path(self):
18        purl = getToolByName(self.context,'portal_url')
19        pw = getToolByName(self.context,'portal_workflow')
20        if not pw.getInfoFor(self.context, 'review_state') == 'published':
21            return '/' + purl.getRelativeContentURL(self.context)
22        entry = IWeblogEntry(self.context).__of__(self.context.aq_inner.aq_parent)
23        weblog_content = entry.getWeblogContentObject()
24        weblog_path = '/' + purl.getRelativeContentURL(weblog_content)
25        return '%s/%s' % (weblog_path,'/'.join(getArchivePathFor(entry, weblog_content)))
26
27
28class DocumentFeedEntry(BaseFeedEntry):
29    """ Fix effective date.
30        BaseFeedEntry overwrite return modification date for
31        getEffectiveDate method. This lead to change entries
32        order in result feed.
33    """
34
35    def getEffectiveDate(self):
36        """See IFeedEntry.
37        """
38        return self.context.effective()
Note: See TracBrowser for help on using the repository browser.