Skip to content

Commit

Permalink
Added mime_type attributes to feedgenerator RssFeed and Atom1Feed, an…
Browse files Browse the repository at this point in the history
…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
adrianholovaty committed Nov 12, 2005
1 parent b2e0591 commit 1bf6dd7
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 1 addition & 1 deletion django/contrib/syndication/views.py
Expand Up @@ -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
2 changes: 2 additions & 0 deletions django/utils/feedgenerator.py
Expand Up @@ -111,6 +111,7 @@ def __init__(self, url, length, mime_type):
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()
Expand Down Expand Up @@ -176,6 +177,7 @@ def write_items(self, handler):

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)
Expand Down

0 comments on commit 1bf6dd7

Please sign in to comment.