unicode results needed for atom feeds

Bug #181903 reported by Edwin Grubbs
4
Affects Status Importance Assigned to Milestone
Launchpad itself
Triaged
Low
Unassigned
Zope 3
Won't Fix
Undecided
Unassigned
zope.publisher
Fix Released
Undecided
Unassigned

Bug Description

I received the following traceback when retrieving an atom feed in zope 3:

Traceback (most recent call last):
  File "/home/egrubbs/canonical/lp-branches/trunk/lib/zope/publisher/publish.py", line 141, in publish
    response.setResult(result)
  File "/home/egrubbs/canonical/lp-branches/trunk/lib/zope/publisher/http.py", line 816, in setResult
    body, headers = self._implicitResult(result)
  File "/home/egrubbs/canonical/lp-branches/trunk/lib/zope/publisher/browser.py", line 680, in _implicitResult
    body, headers = super(BrowserResponse, self)._implicitResult(body)
  File "/home/egrubbs/canonical/lp-branches/trunk/lib/zope/publisher/http.py", line 856, in _implicitResult
    raise ValueError(
ValueError: Unicode results must have a text content type.

Although most feed readers will accept a content type of "text/xml" which will get around this problem, atom feeds are supposed to have the content type of "application/atom+xml" according to FeedValidator.
http://feedvalidator.org/docs/warning/UnexpectedContentType.html

I think that zope.publisher.http.HTTPResponse._implicitResult(self, body) should be more permissive of the content-type header when the body is a unicode object.

Revision history for this message
James Henstridge (jamesh) wrote :

We ran into this problem ages back for the RDF feeds (which have a content type of application/rdf+xml). There the workaround was to make the viewclass explicitly encode the body as UTF-8.

The same should be done for the feeds.

Curtis Hovey (sinzui)
tags: added: tech-debt
Curtis Hovey (sinzui)
Changed in launchpad-foundations:
status: New → Triaged
importance: Undecided → Low
Tres Seaver (tseaver)
Changed in zope3:
status: New → Won't Fix
Tres Seaver (tseaver)
Changed in zope.publisher:
status: New → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.