← Back to team overview

launchpad-reviewers team mailing list archive

[Merge] ~cjwatson/launchpad:py3-rdf-charset into launchpad:master

 

Colin Watson has proposed merging ~cjwatson/launchpad:py3-rdf-charset into launchpad:master.

Commit message:
Add charset="utf-8" to Content-Type for RDF documents

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)

For more details, see:
https://code.launchpad.net/~cjwatson/launchpad/+git/launchpad/+merge/396282

This is otherwise harmless, and makes zope.testbrowser.browser work better with them on Python 3.
-- 
Your team Launchpad code reviewers is requested to review the proposed merge of ~cjwatson/launchpad:py3-rdf-charset into launchpad:master.
diff --git a/lib/lp/registry/browser/__init__.py b/lib/lp/registry/browser/__init__.py
index db7a2e7..19c3b28 100644
--- a/lib/lp/registry/browser/__init__.py
+++ b/lib/lp/registry/browser/__init__.py
@@ -281,7 +281,7 @@ class BaseRdfView(DataDownloadView):
     template = None
     filename = None
 
-    content_type = 'application/rdf+xml'
+    content_type = 'application/rdf+xml;charset="utf-8"'
 
     def getBody(self):
         """Render RDF output, and return it as a string encoded in UTF-8.
diff --git a/lib/lp/registry/browser/person.py b/lib/lp/registry/browser/person.py
index 27fdd52..1d1c2fb 100644
--- a/lib/lp/registry/browser/person.py
+++ b/lib/lp/registry/browser/person.py
@@ -1221,7 +1221,7 @@ class PersonRdfContentsView:
     # parsing of the default text/html content-type.)
     template = ViewPageTemplateFile(
         '../templates/person-rdf-contents.pt',
-        content_type="application/rdf+xml")
+        content_type='application/rdf+xml;charset="utf-8"')
 
     def __init__(self, context, request):
         self.context = context
diff --git a/lib/lp/registry/browser/tests/test_person.py b/lib/lp/registry/browser/tests/test_person.py
index 350afcb..551dea7 100644
--- a/lib/lp/registry/browser/tests/test_person.py
+++ b/lib/lp/registry/browser/tests/test_person.py
@@ -2174,7 +2174,8 @@ class TestPersonRdfView(BrowserTestCase):
         self.assertEqual(
             content_disposition, browser.headers['Content-disposition'])
         self.assertEqual(
-            'application/rdf+xml', browser.headers['Content-type'])
+            'application/rdf+xml;charset="utf-8"',
+            browser.headers['Content-type'])
 
 
 load_tests = load_tests_apply_scenarios
diff --git a/lib/lp/registry/browser/tests/test_product.py b/lib/lp/registry/browser/tests/test_product.py
index 22a4aec..7645a74 100644
--- a/lib/lp/registry/browser/tests/test_product.py
+++ b/lib/lp/registry/browser/tests/test_product.py
@@ -956,7 +956,8 @@ class TestProductRdfView(BrowserTestCase):
         self.assertEqual(
             content_disposition, browser.headers['Content-disposition'])
         self.assertEqual(
-            'application/rdf+xml', browser.headers['Content-type'])
+            'application/rdf+xml;charset="utf-8"',
+            browser.headers['Content-type'])
 
 
 class TestProductSet(BrowserTestCase):
diff --git a/lib/lp/registry/stories/productrelease/xx-productrelease-rdf.txt b/lib/lp/registry/stories/productrelease/xx-productrelease-rdf.txt
index a620ac3..4df089a 100644
--- a/lib/lp/registry/stories/productrelease/xx-productrelease-rdf.txt
+++ b/lib/lp/registry/stories/productrelease/xx-productrelease-rdf.txt
@@ -6,7 +6,7 @@ Check that the productrelease RDF export works.
     HTTP/1.1 200 Ok
     Content-Disposition: attachment; filename="firefox-trunk-0.9.rdf"
     Content-Length: ...
-    Content-Type: application/rdf+xml
+    Content-Type: application/rdf+xml;charset="utf-8"
     ...
     Vary: ...
     <BLANKLINE>
diff --git a/lib/lp/registry/stories/productseries/xx-productseries-rdf.txt b/lib/lp/registry/stories/productseries/xx-productseries-rdf.txt
index 6d142db..13a09de 100644
--- a/lib/lp/registry/stories/productseries/xx-productseries-rdf.txt
+++ b/lib/lp/registry/stories/productseries/xx-productseries-rdf.txt
@@ -6,7 +6,7 @@ Check that the productseries RDF export works.
     HTTP/1.1 200 Ok
     Content-Disposition: attachment; filename="firefox-trunk.rdf"
     Content-Length: ...
-    Content-Type: application/rdf+xml
+    Content-Type: application/rdf+xml;charset="utf-8"
     ...
     Vary: ...
     <BLANKLINE>