source: products/quintagroup.quills.extras/tags/1.3.4/quintagroup/quills/extras/adapters.py

Last change on this file was 784, checked in by crchemist, 17 years ago

Added translation of portal_status_message for all plones.

  • Property svn:eol-style set to native
File size: 933 bytes
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
6from quintagroup.canonicalpath.interfaces import ICanonicalPath
7
8from Products.CMFCore.utils import getToolByName
9
10class quillsCanonicalPathAdapter(object):
11    """Adapts quills entry content to canonical path.
12    """
13    implements(ICanonicalPath)
14
15    def __init__(self, context):
16        self.context = context
17
18    def canonical_path(self):
19        purl = getToolByName(self.context,'portal_url')
20        entry = IWeblogEntry(self.context).__of__(self.context.aq_inner.aq_parent)
21        weblog_content = entry.getWeblogContentObject()
22        weblog_path = '/'+'/'.join(purl.getRelativeContentPath(weblog_content))
23
24        return '%s/%s' % (weblog_path,'/'.join(getArchivePathFor(entry, weblog_content)))
Note: See TracBrowser for help on using the repository browser.