[Zope] ZPT Problem
Geir Bækholt
Geir Bækholt <geirh@funcom.com>
Fri, 3 Jan 2003 11:04:40 +0100
on or about, Friday, January 03, 2003, we have reason to believe that beno =
wrote something along the lines of :
> I have a python script I call from a page template. Here's the call:
> <p tal:replace=3D"structure python:here.contentMacro(template.id)" />
> Here's the script:
> template_id =3D template_id[:-4]
> if (template_id[:-5] !=3D 'frame')
> template_id =3D template_id + '_frame'
> content =3D "<p tal:replace=3D'here/" + template_id + "_content/macros/co=
ntent'=20
/>>\n"
> print content
> return printed
> If this is called from either *index.zpt* or *index_frame.zpt* it renders=
=20
> the following code:
> <p tal:replace=3D'here/index_frame_content/macros/content' />
This is (luckily ;) ) not
the way ZPT works.
Try this (untested code) for your script
template_id =3D template_id[:-4]
if (template_id[:-5] !=3D 'frame'):
template_id =3D template_id + '_frame'
newpath =3D 'here/' + template_id + '_content/macros/content'
return newpath
and change your call to :
<p tal:replace=3D"structure python:path(here.contentMacro(template.id))" />
this should (i hope) give you what you want, although it does not seem
like a very clean solution.
--=20
Geir B=E6kholt geir@funcom.com
Tools/HCI-developer
Tools/Billing - Product Operations
Funcom Oslo