Ticket #5411: atom-config.diff
File atom-config.diff, 2.7 KB (added by , 17 years ago) |
---|
-
django/utils/feedgenerator.py
203 203 # Spec: http://atompub.org/2005/07/11/draft-ietf-atompub-format-10.html 204 204 mime_type = 'application/atom+xml' 205 205 ns = u"http://www.w3.org/2005/Atom" 206 title_type = u'text' 207 summary_type = u'html' 206 208 def write(self, outfile, encoding): 207 209 handler = SimplerXMLGenerator(outfile, encoding) 208 210 handler.startDocument() … … 210 212 handler.startElement(u"feed", {u"xmlns": self.ns, u"xml:lang": self.feed['language']}) 211 213 else: 212 214 handler.startElement(u"feed", {u"xmlns": self.ns}) 213 handler.addQuickElement(u"title", self.feed['title']) 215 handler.addQuickElement(u"title", self.feed['title'], 216 {u'type': self.title_type}) 214 217 handler.addQuickElement(u"link", "", {u"rel": u"alternate", u"href": self.feed['link']}) 215 218 if self.feed['feed_url'] is not None: 216 219 handler.addQuickElement(u"link", "", {u"rel": u"self", u"href": self.feed['feed_url']}) … … 225 228 handler.addQuickElement(u"uri", self.feed['author_link']) 226 229 handler.endElement(u"author") 227 230 if self.feed['subtitle'] is not None: 228 handler.addQuickElement(u"subtitle", self.feed['subtitle']) 231 handler.addQuickElement(u"subtitle", self.feed['subtitle'], 232 {u'type': self.title_type}) 229 233 for cat in self.feed['categories']: 230 234 handler.addQuickElement(u"category", "", {u"term": cat}) 231 235 if self.feed['feed_copyright'] is not None: … … 236 240 def write_items(self, handler): 237 241 for item in self.items: 238 242 handler.startElement(u"entry", {}) 239 handler.addQuickElement(u"title", item['title']) 243 handler.addQuickElement(u"title", item['title'], 244 {u'type': self.title_type}) 240 245 handler.addQuickElement(u"link", u"", {u"href": item['link'], u"rel": u"alternate"}) 241 246 if item['pubdate'] is not None: 242 247 handler.addQuickElement(u"updated", rfc3339_date(item['pubdate']).decode('ascii')) … … 260 265 261 266 # Summary. 262 267 if item['description'] is not None: 263 handler.addQuickElement(u"summary", item['description'], {u"type": u"html"}) 268 handler.addQuickElement(u"summary", item['description'], 269 {u'type': self.summary_type}) 264 270 265 271 # Enclosure. 266 272 if item['enclosure'] is not None: