Ticket #3958: feedgenerator.3.diff

File feedgenerator.3.diff, 1.7 KB (added by Baptiste <baptiste.goupil@…>, 18 years ago)

And a bonus patch that sets the <subtitle> to the given argument subtitle if it exists or the description if not, since the <subtitle> is almost the description. Nothing is broken, and that allows to use the same code for ATOM & RSS feeds.

  • utils/feedgenerator.py

     
    132132            handler.addQuickElement(u"category", cat)
    133133        if self.feed['feed_copyright'] is not None:
    134134            handler.addQuickElement(u"copyright", self.feed['feed_copyright'])
     135        handler.addQuickElement(u"lastBuildDate", rfc2822_date(self.latest_post_date()).decode('ascii'))
    135136        self.write_items(handler)
    136137        self.endChannelElement(handler)
    137138        handler.endElement(u"rss")
     
    199200        else:
    200201            handler.startElement(u"feed", {u"xmlns": self.ns})
    201202        handler.addQuickElement(u"title", self.feed['title'])
     203        if self.feed['subtitle'] is not None or self.feed['description'] is not None:
     204            handler.addQuickElement(u"subtitle", self.feed['subtitle'] or self.feed['description'])
    202205        handler.addQuickElement(u"link", "", {u"rel": u"alternate", u"href": self.feed['link']})
    203206        if self.feed['feed_url'] is not None:
    204207            handler.addQuickElement(u"link", "", {u"rel": u"self", u"href": self.feed['feed_url']})
     
    212215            if self.feed['author_link'] is not None:
    213216                handler.addQuickElement(u"uri", self.feed['author_link'])
    214217            handler.endElement(u"author")
    215         if self.feed['subtitle'] is not None:
    216             handler.addQuickElement(u"subtitle", self.feed['subtitle'])
    217218        for cat in self.feed['categories']:
    218219            handler.addQuickElement(u"category", "", {u"term": cat})
    219220        if self.feed['feed_copyright'] is not None:
Back to Top