Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Added mime_type attributes to feedgenerator RssFeed and Atom1Feed, an…

…d made the syndication view use that mime_type. Thanks, James

git-svn-id: http://code.djangoproject.com/svn/django/trunk@1201 bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information...
commit 1bf6dd7e0e0738b3d4c6c818124f8ecfa3a99936 1 parent b2e0591
Adrian Holovaty authored
2  django/contrib/syndication/views.py
@@ -21,6 +21,6 @@ def feed(request, url, feed_dict=None):
21 21
     except feeds.FeedDoesNotExist:
22 22
         raise Http404, "Invalid feed parameters. Slug %r is valid, but other parameters, or lack thereof, are not." % slug
23 23
 
24  
-    response = HttpResponse(mimetype='application/xml')
  24
+    response = HttpResponse(mimetype=feedgen.mime_type)
25 25
     feedgen.write(response, 'utf-8')
26 26
     return response
2  django/utils/feedgenerator.py
@@ -111,6 +111,7 @@ def __init__(self, url, length, mime_type):
111 111
         self.url, self.length, self.mime_type = url, length, mime_type
112 112
 
113 113
 class RssFeed(SyndicationFeed):
  114
+    mime_type = 'application/rss+xml'
114 115
     def write(self, outfile, encoding):
115 116
         handler = SimplerXMLGenerator(outfile, encoding)
116 117
         handler.startDocument()
@@ -176,6 +177,7 @@ def write_items(self, handler):
176 177
 
177 178
 class Atom1Feed(SyndicationFeed):
178 179
     # Spec: http://atompub.org/2005/07/11/draft-ietf-atompub-format-10.html
  180
+    mime_type = 'application/atom+xml'
179 181
     ns = u"http://www.w3.org/2005/Atom"
180 182
     def write(self, outfile, encoding):
181 183
         handler = SimplerXMLGenerator(outfile, encoding)

0 notes on commit 1bf6dd7

Please sign in to comment.
Something went wrong with that request. Please try again.