diff options
| author | Malcolm Tredinnick <malcolm.tredinnick@gmail.com> | 2007-07-10 12:33:55 +0000 |
|---|---|---|
| committer | Malcolm Tredinnick <malcolm.tredinnick@gmail.com> | 2007-07-10 12:33:55 +0000 |
| commit | 86640f33c1f290a64452ce700e6f3da1ba618bdf (patch) | |
| tree | d4c61b58f064729d74631acabaaa6db25897a30f /django/utils | |
| parent | 87d8976faee7b07a30ce1bd844b2b6178c3a3328 (diff) | |
Fixed #3760 -- Added the ability to manually set feed- and item-level id
elements in Atom feeds. This is fully backwards compatible. Based on a patch
from spark343@cs.ubc.ca.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@5643 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'django/utils')
| -rw-r--r-- | django/utils/feedgenerator.py | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/django/utils/feedgenerator.py b/django/utils/feedgenerator.py index 064ec19120..6b6dedfbe9 100644 --- a/django/utils/feedgenerator.py +++ b/django/utils/feedgenerator.py @@ -41,7 +41,7 @@ class SyndicationFeed(object): "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_url=None, feed_copyright=None, feed_guid=None): to_unicode = lambda s: force_unicode(s, strings_only=True) if categories: categories = [force_unicode(c) for c in categories] @@ -57,6 +57,7 @@ class SyndicationFeed(object): 'categories': categories or (), 'feed_url': iri_to_uri(feed_url), 'feed_copyright': to_unicode(feed_copyright), + 'id': feed_guid or link, } self.items = [] @@ -213,7 +214,7 @@ class Atom1Feed(SyndicationFeed): handler.addQuickElement(u"link", "", {u"rel": u"alternate", u"href": self.feed['link']}) if self.feed['feed_url'] is not None: handler.addQuickElement(u"link", "", {u"rel": u"self", u"href": self.feed['feed_url']}) - handler.addQuickElement(u"id", self.feed['link']) + handler.addQuickElement(u"id", self.feed['id']) handler.addQuickElement(u"updated", rfc3339_date(self.latest_post_date()).decode('ascii')) if self.feed['author_name'] is not None: handler.startElement(u"author", {}) |
