Django

Code

Changeset 6570

Show
Ignore:
Timestamp:
10/20/07 09:54:38 (10 months ago)
Author:
mtredinnick
Message:

Fixed #3502 -- Added TTL support for RSS (not Atom) feeds. Patch from
jason.sidabras@gmail.com and Thomas Kerpe.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • django/trunk/AUTHORS

    r6557 r6570  
    171171    Ben Dean Kawamura <ben.dean.kawamura@gmail.com> 
    172172    Ian G. Kelly <ian.g.kelly@gmail.com> 
     173    Thomas Kerpe <thomas@kerpe.net> 
    173174    Ben Khoo <khoobks@westnet.com.au> 
    174175    Garth Kidd <http://www.deadlybloodyserious.com/> 
     
    274275    John Shaffer <jshaffer2112@gmail.com> 
    275276    Pete Shinners <pete@shinners.org> 
     277    jason.sidabras@gmail.com 
    276278    Jozko Skrablin <jozko.skrablin@gmail.com> 
    277279    SmileyChris <smileychris@gmail.com> 
  • django/trunk/django/contrib/syndication/feeds.py

    r5654 r6570  
    9090            feed_copyright = self.__get_dynamic_attr('feed_copyright', obj), 
    9191            feed_guid = self.__get_dynamic_attr('feed_guid', obj), 
     92            ttl = self.__get_dynamic_attr('ttl', obj), 
    9293        ) 
    9394 
  • django/trunk/django/utils/feedgenerator.py

    r6268 r6570  
    4646    def __init__(self, title, link, description, language=None, author_email=None, 
    4747            author_name=None, author_link=None, subtitle=None, categories=None, 
    48             feed_url=None, feed_copyright=None, feed_guid=None): 
     48            feed_url=None, feed_copyright=None, feed_guid=None, ttl=None): 
    4949        to_unicode = lambda s: force_unicode(s, strings_only=True) 
    5050        if categories: 
     
    6363            'feed_copyright': to_unicode(feed_copyright), 
    6464            'id': feed_guid or link, 
     65            'ttl': ttl, 
    6566        } 
    6667        self.items = [] 
     
    6869    def add_item(self, title, link, description, author_email=None, 
    6970        author_name=None, author_link=None, pubdate=None, comments=None, 
    70         unique_id=None, enclosure=None, categories=(), item_copyright=None): 
     71        unique_id=None, enclosure=None, categories=(), item_copyright=None, ttl=None): 
    7172        """ 
    7273        Adds an item to the feed. All args are expected to be Python Unicode 
     
    9091            'categories': categories or (), 
    9192            'item_copyright': to_unicode(item_copyright), 
     93            'ttl': ttl, 
    9294        }) 
    9395 
     
    147149            handler.addQuickElement(u"copyright", self.feed['feed_copyright']) 
    148150        handler.addQuickElement(u"lastBuildDate", rfc2822_date(self.latest_post_date()).decode('ascii')) 
     151        if self.feed['ttl'] is not None: 
     152            handler.addQuickElement(u"ttl", self.feed['ttl']) 
    149153        self.write_items(handler) 
    150154        self.endChannelElement(handler) 
     
    191195            if item['unique_id'] is not None: 
    192196                handler.addQuickElement(u"guid", item['unique_id']) 
     197            if item['ttl'] is not None: 
     198                handler.addQuickElement(u"ttl", item['ttl']) 
    193199 
    194200            # Enclosure. 
  • django/trunk/docs/syndication_feeds.txt

    r5654 r6570  
    548548        copyright = 'Copyright (c) 2007, Sally Smith' # Hard-coded copyright notice. 
    549549 
     550        # TTL -- One of the following three is optional. The framework looks 
     551        # for them in this order. Ignored for Atom feeds. 
     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 
    550566        # ITEMS -- One of the following three is required. The framework looks 
    551567        # for them in this order.