Ticket #1473: categories.patch
File categories.patch, 3.3 KB (added by , 19 years ago) |
---|
-
django/contrib/syndication/feeds.py
73 73 author_name = self.__get_dynamic_attr('author_name', obj), 74 74 author_link = self.__get_dynamic_attr('author_link', obj), 75 75 author_email = self.__get_dynamic_attr('author_email', obj), 76 categories = self.__get_dynamic_attr('categories', obj), 76 77 ) 77 78 78 79 try: … … 110 111 author_name = author_name, 111 112 author_email = author_email, 112 113 author_link = author_link, 114 categories = self.__get_dynamic_attr('item_categories', item), 113 115 ) 114 116 return feed -
django/utils/feedgenerator.py
128 128 handler.addQuickElement(u"description", self.feed['description']) 129 129 if self.feed['language'] is not None: 130 130 handler.addQuickElement(u"language", self.feed['language']) 131 for cat in self.feed['categories']: 132 handler.addQuickElement(u"category", cat) 131 133 self.write_items(handler) 132 134 self.endChannelElement(handler) 133 135 handler.endElement(u"rss") -
docs/syndication_feeds.txt
439 439 440 440 author_link = 'http://www.example.com/' # Hard-coded author URL. 441 441 442 # CATEGORIES --One of the following three is optional. The framework 443 # looks for them in this order. In each case, the method/attribute 444 # should return an iterable object, that iterates over strings. 445 446 def categories(self, obj): 447 """ 448 Takes the object returned by get_object() and returns the feed's 449 categories as iterable over strings. 450 """ 451 452 def categories(self): 453 """ 454 Returns the feed's categories as iterable over strings. 455 """ 456 457 categories = ("python", "django") # Hard-coded list of categories. 458 442 459 # ITEMS -- One of the following three is required. The framework looks 443 460 # for them in this order. 444 461 … … 602 619 603 620 item_pubdate = datetime.datetime(2005, 5, 3) # Hard-coded pubdate. 604 621 622 # ITEM CATEGORIES -- It's optional to use one of these three. This is a 623 # hook that specifies how to get the list of categories for a given item. 624 # In each case, the method/attribute should return an iterable 625 # object, that iterates over strings. 626 627 def item_categories(self, item): 628 """ 629 Takes an item, as returned by items(), and returns the item's 630 categories. 631 """ 632 633 def item_categories(self): 634 """ 635 Returns the categories for every item in the feed. 636 """ 637 638 item_categories = ("python", "django") # Hard-coded categories. 639 605 640 The low-level framework 606 641 ======================= 607 642