diff options
Diffstat (limited to 'django/utils/feedgenerator.py')
| -rw-r--r-- | django/utils/feedgenerator.py | 26 |
1 files changed, 12 insertions, 14 deletions
diff --git a/django/utils/feedgenerator.py b/django/utils/feedgenerator.py index 367245be22..3a91af3815 100644 --- a/django/utils/feedgenerator.py +++ b/django/utils/feedgenerator.py @@ -89,8 +89,8 @@ def get_tag_uri(url, date): 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_guid=None, ttl=None, **kwargs): + author_name=None, author_link=None, subtitle=None, categories=None, + feed_url=None, feed_copyright=None, feed_guid=None, ttl=None, **kwargs): def to_unicode(s): return force_text(s, strings_only=True) if categories: @@ -117,10 +117,10 @@ class SyndicationFeed(object): 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, unique_id_is_permalink=None, enclosure=None, - categories=(), item_copyright=None, ttl=None, updateddate=None, - enclosures=None, **kwargs): + author_name=None, author_link=None, pubdate=None, comments=None, + unique_id=None, unique_id_is_permalink=None, enclosure=None, + categories=(), item_copyright=None, ttl=None, updateddate=None, + enclosures=None, **kwargs): """ Adds an item to the feed. All args are expected to be Python Unicode objects except pubdate and updateddate, which are datetime.datetime @@ -262,8 +262,7 @@ class RssFeed(SyndicationFeed): handler.addQuickElement("link", self.feed['link']) handler.addQuickElement("description", self.feed['description']) if self.feed['feed_url'] is not None: - handler.addQuickElement("atom:link", None, - {"rel": "self", "href": self.feed['feed_url']}) + handler.addQuickElement("atom:link", None, {"rel": "self", "href": self.feed['feed_url']}) if self.feed['language'] is not None: handler.addQuickElement("language", self.feed['language']) for cat in self.feed['categories']: @@ -309,13 +308,13 @@ class Rss201rev2Feed(RssFeed): # Author information. if item["author_name"] and item["author_email"]: - handler.addQuickElement("author", "%s (%s)" % - (item['author_email'], item['author_name'])) + handler.addQuickElement("author", "%s (%s)" % (item['author_email'], item['author_name'])) elif item["author_email"]: handler.addQuickElement("author", item["author_email"]) elif item["author_name"]: - handler.addQuickElement("dc:creator", item["author_name"], - {"xmlns:dc": "http://purl.org/dc/elements/1.1/"}) + handler.addQuickElement( + "dc:creator", item["author_name"], {"xmlns:dc": "http://purl.org/dc/elements/1.1/"} + ) if item['pubdate'] is not None: handler.addQuickElement("pubDate", rfc2822_date(item['pubdate'])) @@ -324,8 +323,7 @@ class Rss201rev2Feed(RssFeed): if item['unique_id'] is not None: guid_attrs = {} if isinstance(item.get('unique_id_is_permalink'), bool): - guid_attrs['isPermaLink'] = str( - item['unique_id_is_permalink']).lower() + guid_attrs['isPermaLink'] = str(item['unique_id_is_permalink']).lower() handler.addQuickElement("guid", item['unique_id'], guid_attrs) if item['ttl'] is not None: handler.addQuickElement("ttl", item['ttl']) |
