Ticket #502: feedgenerator.patch

File feedgenerator.patch, 1.4 KB (added by eugene@…, 19 years ago)

patch

  • feedgenerator.py

     
    3333
    3434    def add_item(self, title, link, description, author_email=None,
    3535        author_name=None, pubdate=None, comments=None, unique_id=None,
    36         enclosure=None):
     36        enclosure=None, category=None):
    3737        """
    3838        Adds an item to the feed. All args are expected to be Python Unicode
    3939        objects except pubdate, which is a datetime.datetime object, and
     
    4949            'comments': comments,
    5050            'unique_id': unique_id,
    5151            'enclosure': enclosure,
     52            'category': category,
    5253        })
    5354
    5455    def num_items(self):
     
    142143            handler.addQuickElement(u"enclosure", '',
    143144                {u"url": item['enclosure'].url, u"length": item['enclosure'].length,
    144145                    u"type": item['enclosure'].mime_type})
     146        if item['category'] is not None:
     147            if isinstance(item['category'], list):
     148                for cat in item['category']:
     149                    handler.addQuickElement(u"category", cat, {})
     150            else:
     151                handler.addQuickElement(u"category", item['category'], {})
    145152        handler.endElement(u"item")
    146153
    147154# This isolates the decision of what the system default is, so calling code can
Back to Top