Ticket #3502: feed_ttl.2.diff
File feed_ttl.2.diff, 4.4 KB (added by , 17 years ago) |
---|
-
django/contrib/syndication/feeds.py
89 89 categories = self.__get_dynamic_attr('categories', obj), 90 90 feed_copyright = self.__get_dynamic_attr('feed_copyright', obj), 91 91 feed_guid = self.__get_dynamic_attr('feed_guid', obj), 92 ttl = self.__get_dynamic_attr('ttl', obj), 92 93 ) 93 94 94 95 try: -
django/utils/feedgenerator.py
41 41 "Base class for all syndication feeds. Subclasses should provide write()" 42 42 def __init__(self, title, link, description, language=None, author_email=None, 43 43 author_name=None, author_link=None, subtitle=None, categories=None, 44 feed_url=None, feed_copyright=None, feed_guid=None ):44 feed_url=None, feed_copyright=None, feed_guid=None, ttl=None): 45 45 to_unicode = lambda s: force_unicode(s, strings_only=True) 46 46 if categories: 47 47 categories = [force_unicode(c) for c in categories] … … 58 58 'feed_url': iri_to_uri(feed_url), 59 59 'feed_copyright': to_unicode(feed_copyright), 60 60 'id': feed_guid or link, 61 'ttl': ttl, 61 62 } 62 63 self.items = [] 63 64 64 65 def add_item(self, title, link, description, author_email=None, 65 66 author_name=None, author_link=None, pubdate=None, comments=None, 66 unique_id=None, enclosure=None, categories=(), item_copyright=None ):67 unique_id=None, enclosure=None, categories=(), item_copyright=None, ttl=None): 67 68 """ 68 69 Adds an item to the feed. All args are expected to be Python Unicode 69 70 objects except pubdate, which is a datetime.datetime object, and … … 85 86 'enclosure': enclosure, 86 87 'categories': categories or (), 87 88 'item_copyright': to_unicode(item_copyright), 89 'ttl': ttl, 88 90 }) 89 91 90 92 def num_items(self): … … 142 144 if self.feed['feed_copyright'] is not None: 143 145 handler.addQuickElement(u"copyright", self.feed['feed_copyright']) 144 146 handler.addQuickElement(u"lastBuildDate", rfc2822_date(self.latest_post_date()).decode('ascii')) 147 if self.feed['ttl'] is not None: 148 handler.addQuickElement(u"ttl", self.feed['ttl']) 145 149 self.write_items(handler) 146 150 self.endChannelElement(handler) 147 151 handler.endElement(u"rss") … … 186 190 handler.addQuickElement(u"comments", item['comments']) 187 191 if item['unique_id'] is not None: 188 192 handler.addQuickElement(u"guid", item['unique_id']) 193 if item['ttl'] is not None: 194 handler.addQuickElement(u"ttl", item['ttl']) 189 195 190 196 # Enclosure. 191 197 if item['enclosure'] is not None: -
AUTHORS
163 163 Nagy Károly <charlie@rendszergazda.com> 164 164 Ben Dean Kawamura <ben.dean.kawamura@gmail.com> 165 165 Ian G. Kelly <ian.g.kelly@gmail.com> 166 Thomas Kerpe <thomas@kerpe.net> 166 167 Ben Khoo <khoobks@westnet.com.au> 167 168 Garth Kidd <http://www.deadlybloodyserious.com/> 168 169 kilian <kilian.cavalotti@lip6.fr> -
docs/syndication_feeds.txt
547 547 548 548 copyright = 'Copyright (c) 2007, Sally Smith' # Hard-coded copyright notice. 549 549 550 # TTL -- One of the following three is optional. The 551 # framework looks for them in this order. 552 553 def ttl(self, obj): 554 """ 555 Takes the object returned by get_object() and returns the feed's 556 TTL (Time to live) as a normal Python string. 557 """ 558 559 def ttl(self): 560 """ 561 Returns the feed's ttl as a normal Python string. 562 """ 563 564 ttl = 600 # Hard-coded Time to live. 565 566 567 550 568 # ITEMS -- One of the following three is required. The framework looks 551 569 # for them in this order. 552 570