Vince Spicer committed bc07c97

#7 RSS2 fields for feedgenerator

Comments (0)

Files changed (1)


     "Base class for all syndication feeds. Subclasses should provide write()"
     def __init__(self, title, link, description, language=None, author_email=None,
             author_name=None, author_link=None, subtitle=None, categories=None,
-            feed_url=None, feed_copyright=None, feed_guid=None, ttl=None, **kwargs):
+            feed_url=None, feed_copyright=None, feed_guid=None, ttl=None, 
+            generator=None, **kwargs):
         if categories:
             categories = [force_unicode(c) for c in categories]
         self.feed = {
             'feed_copyright': feed_copyright,
             'id': feed_guid or link,
             'ttl': ttl,
+            'generator': generator,
         self.items = []
     def add_item(self, title, link, description, author_email=None,
         author_name=None, author_link=None, pubdate=None, comments=None,
         unique_id=None, enclosure=None, categories=(), item_copyright=None,
-        ttl=None, **kwargs):
+        ttl=None, source=None, **kwargs):
         Adds an item to the feed. All args are expected to be Python Unicode
         objects except pubdate, which is a datetime.datetime object, and
             'categories': categories or (),
             'item_copyright': item_copyright,
             'ttl': ttl,
+            'source', source,
             handler.addQuickElement(u"copyright", self.feed['feed_copyright'])
         handler.addQuickElement(u"lastBuildDate", rfc2822_date(self.latest_post_date()).decode('utf-8'))
         if self.feed['ttl'] is not None:
-            handler.addQuickElement(u"ttl", self.feed['ttl'])
+            handler.addquickelement(u"ttl", self.feed['ttl'])
+        if self.feed['generator'] is not None:
+            handler.addquickelement(u"generator", self.feed['generator'])
     def endChannelElement(self, handler):
             handler.addQuickElement(u"guid", item['unique_id'])
         if item['ttl'] is not None:
             handler.addQuickElement(u"ttl", item['ttl'])
+        if item['source'] is not None:
+            handler.addQuickElement(u"source", item['source'])
         # Enclosure.
         if item['enclosure'] is not None: