summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdrian Holovaty <adrian@holovaty.com>2005-11-12 18:32:12 +0000
committerAdrian Holovaty <adrian@holovaty.com>2005-11-12 18:32:12 +0000
commit1bf6dd7e0e0738b3d4c6c818124f8ecfa3a99936 (patch)
tree87e3904d8d3ee5810fa948265e4200745c0b032b
parentb2e05910edd1d077bd40f1353883031ddb5a255a (diff)
Added mime_type attributes to feedgenerator RssFeed and Atom1Feed, and 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
-rw-r--r--django/contrib/syndication/views.py2
-rw-r--r--django/utils/feedgenerator.py2
2 files changed, 3 insertions, 1 deletions
diff --git a/django/contrib/syndication/views.py b/django/contrib/syndication/views.py
index 3236f9dfab..3bab3bcac9 100644
--- a/django/contrib/syndication/views.py
+++ b/django/contrib/syndication/views.py
@@ -21,6 +21,6 @@ def feed(request, url, feed_dict=None):
except feeds.FeedDoesNotExist:
raise Http404, "Invalid feed parameters. Slug %r is valid, but other parameters, or lack thereof, are not." % slug
- response = HttpResponse(mimetype='application/xml')
+ response = HttpResponse(mimetype=feedgen.mime_type)
feedgen.write(response, 'utf-8')
return response
diff --git a/django/utils/feedgenerator.py b/django/utils/feedgenerator.py
index d482685383..696b55d493 100644
--- a/django/utils/feedgenerator.py
+++ b/django/utils/feedgenerator.py
@@ -111,6 +111,7 @@ class Enclosure:
self.url, self.length, self.mime_type = url, length, mime_type
class RssFeed(SyndicationFeed):
+ mime_type = 'application/rss+xml'
def write(self, outfile, encoding):
handler = SimplerXMLGenerator(outfile, encoding)
handler.startDocument()
@@ -176,6 +177,7 @@ class Rss201rev2Feed(RssFeed):
class Atom1Feed(SyndicationFeed):
# Spec: http://atompub.org/2005/07/11/draft-ietf-atompub-format-10.html
+ mime_type = 'application/atom+xml'
ns = u"http://www.w3.org/2005/Atom"
def write(self, outfile, encoding):
handler = SimplerXMLGenerator(outfile, encoding)