Loading django/contrib/syndication/feeds.py +2 −0 Original line number Diff line number Diff line Loading @@ -73,6 +73,7 @@ class Feed(object): author_name = self.__get_dynamic_attr('author_name', obj), author_link = self.__get_dynamic_attr('author_link', obj), author_email = self.__get_dynamic_attr('author_email', obj), categories = self.__get_dynamic_attr('categories', obj), ) try: Loading Loading @@ -110,5 +111,6 @@ class Feed(object): author_name = author_name, author_email = author_email, author_link = author_link, categories = self.__get_dynamic_attr('item_categories', item), ) return feed django/utils/feedgenerator.py +2 −0 Original line number Diff line number Diff line Loading @@ -126,6 +126,8 @@ class RssFeed(SyndicationFeed): handler.addQuickElement(u"description", self.feed['description']) if self.feed['language'] is not None: handler.addQuickElement(u"language", self.feed['language']) for cat in self.feed['categories']: handler.addQuickElement(u"category", cat) self.write_items(handler) self.endChannelElement(handler) handler.endElement(u"rss") Loading docs/syndication_feeds.txt +36 −0 Original line number Diff line number Diff line Loading @@ -439,6 +439,23 @@ This example illustrates all possible attributes and methods for a ``Feed`` clas author_link = 'http://www.example.com/' # Hard-coded author URL. # CATEGORIES -- One of the following three is optional. The framework # looks for them in this order. In each case, the method/attribute # should return an iterable object that returns strings. def categories(self, obj): """ Takes the object returned by get_object() and returns the feed's categories as iterable over strings. """ def categories(self): """ Returns the feed's categories as iterable over strings. """ categories = ("python", "django") # Hard-coded list of categories. # ITEMS -- One of the following three is required. The framework looks # for them in this order. Loading Loading @@ -602,6 +619,25 @@ This example illustrates all possible attributes and methods for a ``Feed`` clas item_pubdate = datetime.datetime(2005, 5, 3) # Hard-coded pubdate. # ITEM CATEGORIES -- It's optional to use one of these three. This is # a hook that specifies how to get the list of categories for a given # item. In each case, the method/attribute should return an iterable # object that returns strings. def item_categories(self, item): """ Takes an item, as returned by items(), and returns the item's categories. """ def item_categories(self): """ Returns the categories for every item in the feed. """ item_categories = ("python", "django") # Hard-coded categories. The low-level framework ======================= Loading Loading
django/contrib/syndication/feeds.py +2 −0 Original line number Diff line number Diff line Loading @@ -73,6 +73,7 @@ class Feed(object): author_name = self.__get_dynamic_attr('author_name', obj), author_link = self.__get_dynamic_attr('author_link', obj), author_email = self.__get_dynamic_attr('author_email', obj), categories = self.__get_dynamic_attr('categories', obj), ) try: Loading Loading @@ -110,5 +111,6 @@ class Feed(object): author_name = author_name, author_email = author_email, author_link = author_link, categories = self.__get_dynamic_attr('item_categories', item), ) return feed
django/utils/feedgenerator.py +2 −0 Original line number Diff line number Diff line Loading @@ -126,6 +126,8 @@ class RssFeed(SyndicationFeed): handler.addQuickElement(u"description", self.feed['description']) if self.feed['language'] is not None: handler.addQuickElement(u"language", self.feed['language']) for cat in self.feed['categories']: handler.addQuickElement(u"category", cat) self.write_items(handler) self.endChannelElement(handler) handler.endElement(u"rss") Loading
docs/syndication_feeds.txt +36 −0 Original line number Diff line number Diff line Loading @@ -439,6 +439,23 @@ This example illustrates all possible attributes and methods for a ``Feed`` clas author_link = 'http://www.example.com/' # Hard-coded author URL. # CATEGORIES -- One of the following three is optional. The framework # looks for them in this order. In each case, the method/attribute # should return an iterable object that returns strings. def categories(self, obj): """ Takes the object returned by get_object() and returns the feed's categories as iterable over strings. """ def categories(self): """ Returns the feed's categories as iterable over strings. """ categories = ("python", "django") # Hard-coded list of categories. # ITEMS -- One of the following three is required. The framework looks # for them in this order. Loading Loading @@ -602,6 +619,25 @@ This example illustrates all possible attributes and methods for a ``Feed`` clas item_pubdate = datetime.datetime(2005, 5, 3) # Hard-coded pubdate. # ITEM CATEGORIES -- It's optional to use one of these three. This is # a hook that specifies how to get the list of categories for a given # item. In each case, the method/attribute should return an iterable # object that returns strings. def item_categories(self, item): """ Takes an item, as returned by items(), and returns the item's categories. """ def item_categories(self): """ Returns the categories for every item in the feed. """ item_categories = ("python", "django") # Hard-coded categories. The low-level framework ======================= Loading