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
_______________________________________________
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://mail.zope.org/mailman/listinfo/zope-announce
 http://mail.zope.org/mailman/listinfo/zope-dev )

Reply via email to