### Eclipse Workspace Patch 1.0
#P django-trunk
|
|
|
71 | 71 | "Base class for all syndication feeds. Subclasses should provide write()" |
72 | 72 | def __init__(self, title, link, description, language=None, author_email=None, |
73 | 73 | author_name=None, author_link=None, subtitle=None, categories=None, |
74 | | feed_url=None, feed_copyright=None, feed_guid=None, ttl=None, **kwargs): |
| 74 | feed_url=None, feed_copyright=None, feed_guid=None, ttl=None, stylesheets=None, **kwargs): |
75 | 75 | to_unicode = lambda s: force_unicode(s, strings_only=True) |
76 | 76 | if categories: |
77 | 77 | categories = [force_unicode(c) for c in categories] |
78 | 78 | if ttl is not None: |
79 | 79 | # Force ints to unicode |
80 | 80 | ttl = force_unicode(ttl) |
| 81 | if stylesheets: |
| 82 | stylesheets = [iri_to_uri(s) for s in stylesheets] |
81 | 83 | self.feed = { |
82 | 84 | 'title': to_unicode(title), |
83 | 85 | 'link': iri_to_uri(link), |
… |
… |
|
92 | 94 | 'feed_copyright': to_unicode(feed_copyright), |
93 | 95 | 'id': feed_guid or link, |
94 | 96 | 'ttl': ttl, |
| 97 | 'stylesheets': stylesheets or (), |
95 | 98 | } |
96 | 99 | self.feed.update(kwargs) |
97 | 100 | self.items = [] |
… |
… |
|
198 | 201 | def write(self, outfile, encoding): |
199 | 202 | handler = SimplerXMLGenerator(outfile, encoding) |
200 | 203 | handler.startDocument() |
| 204 | for s in self.feed['stylesheets']: |
| 205 | handler.processingInstruction('xml-stylesheet', 'type="text/css" href="%s"' % s) # http://www.w3.org/TR/xml-stylesheet/ |
201 | 206 | handler.startElement(u"rss", self.rss_attributes()) |
202 | 207 | handler.startElement(u"channel", self.root_attributes()) |
203 | 208 | self.add_root_elements(handler) |