Django

Code

Show
Ignore:
Timestamp:
08/16/08 15:40:47 (3 months ago)
Author:
jbronn
Message:

Fixed #6547, added support for GeoRSS feeds in django.contrib.gis.feeds; added the feed_extra_kwargs and item_extra_kwargs to the Feed baseclass so that it's possible for subclasses to add dynamic attributes.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • django/trunk/django/contrib/syndication/feeds.py

    r8310 r8414  
    6060        return attr 
    6161 
     62    def feed_extra_kwargs(self, obj): 
     63        """ 
     64        Returns an extra keyword arguments dictionary that is used when 
     65        initializing the feed generator. 
     66        """ 
     67        return {} 
     68 
     69    def item_extra_kwargs(self, item): 
     70        """ 
     71        Returns an extra keyword arguments dictionary that is used with 
     72        the `add_item` call of the feed generator. 
     73        """ 
     74        return {} 
     75 
    6276    def get_object(self, bits): 
    6377        return None 
     
    101115            feed_guid = self.__get_dynamic_attr('feed_guid', obj), 
    102116            ttl = self.__get_dynamic_attr('ttl', obj), 
     117            **self.feed_extra_kwargs(obj) 
    103118        ) 
    104119 
     
    159174                categories = self.__get_dynamic_attr('item_categories', item), 
    160175                item_copyright = self.__get_dynamic_attr('item_copyright', item), 
     176                **self.item_extra_kwargs(item) 
    161177            ) 
    162178        return feed