[783] | 1 | from zope.interface import implements |
---|
| 2 | |
---|
| 3 | from quills.core.interfaces import IWeblogEntry |
---|
| 4 | from quills.core.interfaces.enabled import IPossibleWeblogEntry |
---|
| 5 | from quills.app.utilities import getArchivePathFor, getArchivePathFor |
---|
| 6 | |
---|
| 7 | from Products.CMFCore.utils import getToolByName |
---|
| 8 | |
---|
[979] | 9 | from Products.fatsyndication.adapters.feedentry import DocumentFeedEntry as BaseFeedEntry |
---|
| 10 | |
---|
[783] | 11 | class 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') |
---|
[974] | 19 | pw = getToolByName(self.context,'portal_workflow') |
---|
| 20 | if not pw.getInfoFor(self.context, 'review_state') == 'published': |
---|
| 21 | return '/' + purl.getRelativeContentURL(self.context) |
---|
[783] | 22 | entry = IWeblogEntry(self.context).__of__(self.context.aq_inner.aq_parent) |
---|
| 23 | weblog_content = entry.getWeblogContentObject() |
---|
[974] | 24 | weblog_path = '/' + purl.getRelativeContentURL(weblog_content) |
---|
[784] | 25 | return '%s/%s' % (weblog_path,'/'.join(getArchivePathFor(entry, weblog_content))) |
---|
[979] | 26 | |
---|
| 27 | |
---|
| 28 | class 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() |
---|