Commits

Mike Orr committed 7208d5b

Add 'generator' and 'source' properties to RSS2 feeds. Patch by Vince Spicer.

Comments (0)

Files changed (2)

 1.0b1 (tip)
 * webhelpers.feedgenerator:
   - ``rfc3339_date`` now accepts date objects without crashing.
+  - Add 'generator' and 'source' properties to RSS2 feeds. Patch by
+    Vince Spicer.
 * webhelpers.html.converters:
   - New helper ``render()`` formats HTML to text.
   - New helper ``sanitize()`` strips HTML tags from user input.

webhelpers/feedgenerator.py

     """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):
+            feed_url=None, feed_copyright=None, feed_guid=None, ttl=None, 
+            generator=None, source=None):
         self.feed = {
             'title': title,
             'link': link,
             'feed_copyright': feed_copyright,
             'id': feed_guid or link,
             'ttl': ttl,
+            'generator': generator,
+            'source': source,
         }
         self.items = []
 
                 handler.addQuickElement(u"guid", item['unique_id'])
             if item['ttl'] is not None:
                 handler.addQuickElement(u"ttl", item['ttl'])
+            if item['generator'] is not None:
+                handler.addQuickElement(u"generator", item['generator'])
+            if item['source'] is not None:
+                handler.addQuickElement(u"source", item['source'])
 
             # Enclosure.
             if item['enclosure'] is not None:
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.