[ZPT] Content-Type on PageTemplate (for CSS)

Florent Guillaume fg@nuxeo.com
Sat, 26 Jan 2002 19:23:39 +0000 (UTC)


On a related note, I tried to serve CSS files using Page Templates.

My first try was to set Content-Type to text/css and serve a page
like thus:

<tal:block define="p here/stylesheet_properties">
p {
    font-family: <p tal:replace="p/primary_font_family" />;
}
</tal:block>

But Zope serves the page as is, without interpreting TAL.
Why ?


I ended up giving the Page Template a Content-Type of text/html
and doing:

<tal:block define="dummy python:request.RESPONSE.setHeader('Content-Type','text/css');
                   p here/stylesheet_properties">
p {
    font-family: <p tal:replace="p/primary_font_family" />;
}
</tal:block>

Which works, but is not pretty.


Florent
-- 
Florent Guillaume, Nuxeo (Paris, France)
+33 1 40 33 79 10  http://nuxeo.com  mailto:fg@nuxeo.com