[Zope] Other content types and ZPT

Dieter Maurer dieter@handshake.de
Wed, 21 May 2003 21:16:48 +0200


Jeremy Cook wrote at 2003-5-21 11:17 +0200:
 > ...
 > If I create a 'page template' called 'RMTheJam.ram' with a simple line
 > pointing (for now) to a hardcoded URL:
 > 
 > http://217-13-29-76.dd.nextgentel.com/KSMi/interactive/TheJamBam.rm
 > 
 > and then in the Page template editor change the content_type from
 > text/html to audio/x-pn-realaudio then I get an error 
 > 
 >   "cannot import name expat".
 > 

As the content type is not "text/html", the page template
assumes it has XML content.
"expat" is an XML parser. It is not installed by default
(at least with Python 2.1.x).

 > Any ideas how to achieve a dynamic real audio metafile?

Someone else already suggested to use a Python Script (a very
good suggestion!).

An alternative would be to keep the "text/html" content type
and set it explicitely in the template:

    <tal:dummy define="dummy python:request.RESPONSE.setHeader('Content-Type','audio/x-pn-realaudio')"/>


When I remember right, there was a bug in "PageTemplate" which let
the above code fail (not set the header) in some circumstances
(I will probably work in your case).


Dieter