On Wednesday 01 March 2006 11:22, Frank Burkhardt wrote:
> Hi,
> I wrote a view that returns a Atom-document (comparable to RSS). The
> content type is 'application/atom+xml'. Unfortunately the pagetemplate
> inserts some strings containing german umlauts (non-ascii) and I
> get this error:

Honestly, the content type declaration sucks, but I know, you cannot do 
anything about that. :-(

> ValueError: Unicode results must have a text content type.
> I found this line in zope.publisher.http:
>  if not content_type.startswith('text/'):
>   raise ValueError(
>   [...]
> which explains everything.


> I tried to insert the umlauts in HTML notation (e.g. 'ü') but
> zope outsmarted me and escaped the '&' :-( .
> My Question is: What is the best way (tm) to handle that?

There are two solutions to the problem:

1. Write your own request/response object; I think someone has done that 

2. Instead of returning a string, return an IResult object. Then the indicated 
piece of code will be ignored.

Stephan Richter
CBU Physics & Chemistry (B.S.) / Tufts Physics (Ph.D. student)
Web2k - Web Software Design, Development and Training
Zope3-users mailing list

Reply via email to