[ZPT] return page from script

Clemens Klein-Robbenhaar crobbenhaar at web.de
Tue Sep 13 19:41:38 EDT 2005


Hi celtek,

> I have little problem with return page_zpt from script.
>  
> (with script) folder1--|
>                              |--folder2 (with page_zpt)
>                               
> In python script I have something like this:
>  
> return  context.page_zpt(value=value,value2=value2)
>  
> Now it looks like script can't find 'page_zpt'.
> So, how should I return this zpt with parameters in this case? 

  If I understand the folder structure correctly, You have
two folders in the Zope root, one named folder1 and the other folder2

Now by default the script in folder1 cannot call the page template in folder2
via its context, because the contents of folder2 are normally
not in the context of the script. (Calling the script in the browser via the url
/folder1/folder2/script
should help it finding the page template.)

  If You do not rename folder2, You can get the page template
by explicitely telling the "context" that You are looking in folder2:

  return context.folder2.page_zpt(value=value,value2=value2)


hope this helps,
clemens


More information about the ZPT mailing list