Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

[1.2.X] Fixed #15237 -- Always set charset of Atom1 feeds to UTF-8. T…

…hanks, Simon and jasonkotenko.

Backport from trunk (r15505).

git-svn-id: http://code.djangoproject.com/svn/django/branches/releases/1.2.X@15512 bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information...
commit 6a438e2d1ab9bfdb2b4ae4cff121f812dd5fd241 1 parent 748110c
Jannis Leidel authored February 12, 2011
3  django/contrib/syndication/views.py
... ...
@@ -1,9 +1,8 @@
1  
-import datetime
2 1
 from django.conf import settings
3 2
 from django.contrib.sites.models import get_current_site
4 3
 from django.core.exceptions import ImproperlyConfigured, ObjectDoesNotExist
5 4
 from django.http import HttpResponse, Http404
6  
-from django.template import loader, Template, TemplateDoesNotExist, RequestContext
  5
+from django.template import loader, TemplateDoesNotExist, RequestContext
7 6
 from django.utils import feedgenerator, tzinfo
8 7
 from django.utils.encoding import force_unicode, iri_to_uri, smart_unicode
9 8
 from django.utils.html import escape
2  django/utils/feedgenerator.py
@@ -285,7 +285,7 @@ def add_item_elements(self, handler, item):
285 285
 
286 286
 class Atom1Feed(SyndicationFeed):
287 287
     # Spec: http://atompub.org/2005/07/11/draft-ietf-atompub-format-10.html
288  
-    mime_type = 'application/atom+xml'
  288
+    mime_type = 'application/atom+xml; charset=utf8'
289 289
     ns = u"http://www.w3.org/2005/Atom"
290 290
 
291 291
     def write(self, outfile, encoding):
9  tests/regressiontests/utils/feedgenerator.py
@@ -61,3 +61,12 @@ def test_rfc3339_date_with_timezone(self):
61 61
             "2008-11-14T13:37:00+02:00"
62 62
         )
63 63
 
  64
+    def test_atom1_mime_type(self):
  65
+        """
  66
+        Test to make sure Atom MIME type has UTF8 Charset parameter set
  67
+        """
  68
+        atom_feed = feedgenerator.Atom1Feed("title", "link", "description")
  69
+        self.assertEqual(
  70
+            atom_feed.mime_type, "application/atom+xml; charset=utf8"
  71
+        )
  72
+

0 notes on commit 6a438e2

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