[Zope] Storing unicode in ZODB objects
Paul Winkler
slinkp at gmail.com
Tue Dec 16 09:24:51 EST 2008
On Mon, Dec 15, 2008 at 03:52:35PM -0500, Thibaud Morel l'Horset wrote:
> That's a great tip about setting the content_type charset correctly. The
> way I was handling this so far was to specify it in the header of the page
> that was displaying the text:
> <span
> tal:content="nocall:python:request.response.setHeader('Content-Type','text/html;
> charset=UTF-8')" tal:omit-tag=""></span>
On a stylistic tangent: combining "nocall" with "python" doesn't make
any sense, and I don't believe it has any effect. Nocall's purpose is
to prevent implicitly calling the object traversed at the end of a
*path* expression.
Also, don't use tal:content when you don't actually want to insert the
result of the expression. The most common idiom I've seen when calling
something purely for side effects is to abuse tal:define:
<span tal:define="dummy python:request.response.setHeader(...)"
tal:omit-tag="" />
Or, better, put the define in a tag that actually serves a purpose and
you can leave out the omit-tag as well:
<head tal:define="dummy python:...">
...
</head>
--
Paul Winkler
http://www.slinkp.com
More information about the Zope
mailing list