[Zope3-Users] Inline code in ZPT

Stephan Richter srichter at cosmos.phy.tufts.edu
Fri Jul 15 12:59:11 EDT 2005


On Wednesday 06 July 2005 15:47, Nicolas Legault wrote:
> 1:
> Is it possible to have Inline code in a page template that is created on
> the host file system, not throught the ZMI ? 

Yes.

> I got an error that inline code is not activated, where do I activate it ?

Right, by default inline code is deactivated. You would have to write some 
custom code to accomplish that. However, we discourage people to add Python 
code in page templates.

> 2:
> Is it a bug or this code is now not supported in Zope 3.1 ZPT ?
>
>           01 <html><body>
>           02   <script type="text/server-python">
>           03     global x
>           04     x = "Hello World!"
>           05   </script>
>           06   <b tal:content="x" />
>           07 </body></html>
> this code is from
> http://www.zope.org/Wikis/DevSite/Projects/ComponentArchitecture/Zope3GUI

For some reason this example does not work, since the variable "x" is not 
exported beyond the script tag. For some reason the "global x" call does not 
do what it used to do.

> If it's not supported anymore, is there a way to return values from the
> python script and use them in the zpt ?

Florian gave you the right answer.

Regards,
Stephan
-- 
Stephan Richter
CBU Physics & Chemistry (B.S.) / Tufts Physics (Ph.D. student)
Web2k - Web Software Design, Development and Training


More information about the Zope3-users mailing list