Changeset 4478
- Timestamp:
- 02/10/07 02:36:39 (2 years ago)
- Files:
-
- django/trunk/AUTHORS (modified) (2 diffs)
- django/trunk/django/contrib/syndication/feeds.py (modified) (2 diffs)
- django/trunk/django/utils/feedgenerator.py (modified) (7 diffs)
- django/trunk/docs/syndication_feeds.txt (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
django/trunk/AUTHORS
r4477 r4478 45 45 akaihola 46 46 Andreas 47 andy@jadedplanet.net 47 48 ant9000@netwise.it 48 49 David Ascher <http://ascher.ca/> … … 56 57 Simon Blanchard 57 58 Andrew Brehaut <http://brehaut.net/blog> 58 andy@jadedplanet.net59 Jonathan Buchanan <jonathan.buchanan@gmail.com> 59 60 Antonio Cavedoni <http://cavedoni.com/> 60 61 C8E django/trunk/django/contrib/syndication/feeds.py
r4265 r4478 79 79 author_email = self.__get_dynamic_attr('author_email', obj), 80 80 categories = self.__get_dynamic_attr('categories', obj), 81 feed_copyright = self.__get_dynamic_attr('feed_copyright', obj), 81 82 ) 82 83 … … 117 118 author_link = author_link, 118 119 categories = self.__get_dynamic_attr('item_categories', item), 120 item_copyright = self.__get_dynamic_attr('item_copyright', item), 119 121 ) 120 122 return feed django/trunk/django/utils/feedgenerator.py
r4265 r4478 41 41 def __init__(self, title, link, description, language=None, author_email=None, 42 42 author_name=None, author_link=None, subtitle=None, categories=None, 43 feed_url=None ):43 feed_url=None, feed_copyright=None): 44 44 self.feed = { 45 45 'title': title, … … 53 53 'categories': categories or (), 54 54 'feed_url': feed_url, 55 'feed_copyright': feed_copyright, 55 56 } 56 57 self.items = [] … … 58 59 def add_item(self, title, link, description, author_email=None, 59 60 author_name=None, author_link=None, pubdate=None, comments=None, 60 unique_id=None, enclosure=None, categories=() ):61 unique_id=None, enclosure=None, categories=(), item_copyright=None): 61 62 """ 62 63 Adds an item to the feed. All args are expected to be Python Unicode … … 76 77 'enclosure': enclosure, 77 78 'categories': categories or (), 79 'item_copyright': item_copyright, 78 80 }) 79 81 … … 129 131 for cat in self.feed['categories']: 130 132 handler.addQuickElement(u"category", cat) 133 if self.feed['feed_copyright'] is not None: 134 handler.addQuickElement(u"copyright", self.feed['feed_copyright']) 131 135 self.write_items(handler) 132 136 self.endChannelElement(handler) … … 213 217 for cat in self.feed['categories']: 214 218 handler.addQuickElement(u"category", "", {u"term": cat}) 219 if self.feed['feed_copyright'] is not None: 220 handler.addQuickElement(u"rights", self.feed['feed_copyright']) 215 221 self.write_items(handler) 216 222 handler.endElement(u"feed") … … 253 259 u"type": item['enclosure'].mime_type}) 254 260 255 # Categories :261 # Categories. 256 262 for cat in item['categories']: 257 263 handler.addQuickElement(u"category", u"", {u"term": cat}) 264 265 # Rights. 266 if item['item_copyright'] is not None: 267 handler.addQuickElement(u"rights", item['item_copyright']) 258 268 259 269 handler.endElement(u"entry") django/trunk/docs/syndication_feeds.txt
r4420 r4478 128 128 129 129 * ``{{ obj }}`` -- The current object (one of whichever objects you 130 returned in ``items()``). 130 returned in ``items()``). 131 131 * ``{{ site }}`` -- A ``django.models.core.sites.Site`` object 132 132 representing the current site. This is useful for … … 479 479 categories = ("python", "django") # Hard-coded list of categories. 480 480 481 # COPYRIGHT NOTICE -- One of the following three is optional. The 482 # framework looks for them in this order. 483 484 def copyright(self, obj): 485 """ 486 Takes the object returned by get_object() and returns the feed's 487 copyright notice as a normal Python string. 488 """ 489 490 def copyright(self): 491 """ 492 Returns the feed's copyright notice as a normal Python string. 493 """ 494 495 copyright = 'Copyright (c) 2007, Sally Smith' # Hard-coded copyright notice. 496 481 497 # ITEMS -- One of the following three is required. The framework looks 482 498 # for them in this order. … … 659 675 660 676 item_categories = ("python", "django") # Hard-coded categories. 677 678 # ITEM COPYRIGHT NOTICE (only applicable to Atom feeds) -- One of the 679 # following three is optional. The framework looks for them in this 680 # order. 681 682 def item_copyright(self, obj): 683 """ 684 Takes an item, as returned by items(), and returns the item's 685 copyright notice as a normal Python string. 686 """ 687 688 def item_copyright(self): 689 """ 690 Returns the copyright notice for every item in the feed. 691 """ 692 693 item_copyright = 'Copyright (c) 2007, Sally Smith' # Hard-coded copyright notice. 661 694 662 695
