Other content types and ZPT
Hi, I want to create a real audio metafile (.ram extension) on the fly using templates but am struggling with this. A .ram file should contain a single line with the URL of the media file that I want the client browser to play. I want to create this URL using ZPT so that the correct URL relative to the portal home is given. I don't want to use a hard coded URL because that would mean that my media content wouldn't work when I move my portal to another location for off-line editing. It would also mean that links could be broken in an obscure way some time in the future. 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". Any ideas how to achieve a dynamic real audio metafile? I am running zope 2.6.1 Thanks, -- Jeremy Cook <Jeremy.Cook@ii.uib.no> Parallab
Jeremy Cook wrote:
Hi,
I want to create a real audio metafile (.ram extension) on the fly using templates but am struggling with this. A .ram file should contain a single line with the URL of the media file that I want the client browser to play. I want to create this URL using ZPT so that the correct URL relative to the portal home is given.
I don't want to use a hard coded URL because that would mean that my media content wouldn't work when I move my portal to another location for off-line editing. It would also mean that links could be broken in an obscure way some time in the future.
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".
Any ideas how to achieve a dynamic real audio metafile?
Why not use a python script for that? cheers, oliver
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
participants (3)
-
Dieter Maurer -
Jeremy Cook -
Oliver Bleutgen