Ejemplo n.º 1
0
class WeblogFeedSource(BaseFeedSource):
    """Adapter from Quills Weblog instances to IFeedSource
    """

    implements(IFeedSource)

    def __init__(self, context):
        self.context = IWeblog(context)

    def getFeedEntries(self, max_only=True):
        """See IFeedSoure
        """
        if max_only:
            num_of_entries = self.getMaxEntries()
        else:
            num_of_entries = 0 # signals to fetch _all_ items
        brains = self.context.getEntries(num_of_entries)
        return [IFeedEntry(brain.getObject()) for brain in brains]

    # Quills always returns sorted entries, so we can override fatsyndications
    # expensive (but generic) implementation:
    getSortedFeedEntries = getFeedEntries