# Zope 3 imports from zope.interface import implements # CMF imports from Products.CMFCore.utils import getToolByName # fatsyndication imports from Products.fatsyndication.adapters import BaseFeed, BaseFeedSource, \ BaseFeedEntry from Products.basesyndication.interfaces import IFeed, IFeedSource, \ IFeedEntry class WeblogFeed(BaseFeed): pass class WeblogFeedSource(BaseFeedSource): """Adapter from Quills Weblog instances to IFeedSource """ implements(IFeedSource) def getFeedEntries(self): """See IFeedSoure """ brains = self.context.getLazyEntries() return [IFeedEntry(brain.getObject()) for brain in brains] class TopicFeed(BaseFeed): pass class TopicFeedSource(BaseFeedSource): """Adapter from Quills Topic instances to IFeedSource """ implements(IFeedSource) def getFeedEntries(self): """See IFeedSoure """ brains = self.context.getLazyEntries() return [IFeedEntry(brain.getObject()) for brain in brains] class WeblogEntryFeed(BaseFeed): pass class WeblogEntryFeedSource(BaseFeedSource): """An adapter from IWeblogEntry to IFeedSource that feeds out the entry's comments. """ implements(IFeedSource) def getFeedEntries(self): """See IFeedSource """ d_tool = getToolByName(self.context, 'portal_discussion') discussion = d_tool.getDiscussionFor(self.context) replies = [IFeedEntry(reply) for reply in discussion.getReplies()] return [IFeedEntry(self.context)] + replies class WeblogEntryFeedEntry(BaseFeedEntry): """ """ implements(IFeedEntry) def getBody(self): """See IFeedEntry. """ return self.context.getText()