[Zope-dev] FS PageTemplates and XML generation issues

Florent Guillaume fg at nuxeo.com
Wed Dec 22 09:38:58 EST 2004


Alan Milligan  <alan at balclutha.org> wrote:
> I have some PT skins I'm using to generate XML responses and am getting
> some strange behaviour.  I'm not sure if its because I misunderstand
> something, there are bugs, or the API could be made more useful.
> 
> I will focus this discussion around the following ZPT:
> 
> <?xml version="1.0" encoding="UTF-8"?>
> <repomd xmlns="http://linux.duke.edu/metadata/repo">
> ~  <data type="other" tal:repeat="source here/objectValues"
> tal:attributes="type source/meta_type">
> ~    <location href="" tal:attributes="href string:repodata/${source/id}"/>
> ~    <checksum type="sha" tal:content="source/checksum"/>
> ~    <timestamp tal:content="source/timestamp"/>
> ~    <open-checksum type="sha" tal:content="source/open_checksum"/>
> ~  </data>
> </repomd>
> 
> 
> What is happening with this is that it's not doing any TAL rendering at
> all and just returning this 'raw' xml.  However, if I customise my skin
> and assure the content-type is text/html, then it indeed renders this 'xml'.
> 
> I have experimented with the xmlns on this to no avail.  Besides, it
> surely must be implicit in the choice of making this a FSPT, that I am
> anticipating TAL/METAL rendering, and that any non-(ME)TAL tags in the
> raw text are to be passed thru to the client...

ZPT will process tal instructions in XML templates only if the proper
namespace is declared. You must have:

  xmlns:tal="http://xml.zope.org/namespaces/tal"

> I am also concerned that the FSPT code has implicitly assumed that the
> content type is text/xml.  While I'd prefer this to be the type, at this
> stage, this choice does not work ...

The <?xml start switches page template files to text/xml.

> I would however have thought that in lieu of an explicit statement, any
> FSPT would be of type text/html...
> 
> This brings me to my other question:  how do I set the content-type on
> an FSPT??  It would seem that content-type=xxx in the [default] section
> of the .metadata file is ignored.

Use:

[default]
content_type = text/foobar

Florent

-- 
Florent Guillaume, Nuxeo (Paris, France)   CTO, Director of R&D
+33 1 40 33 71 59   http://nuxeo.com   fg at nuxeo.com


More information about the Zope-Dev mailing list