[Zope] Newbies & variables

Troy Farrell troy@entheossoft.com
Sun, 03 Feb 2002 00:10:34 -0600


Gary,
Is page_body listed as a Python Script parameter?  If not, try adding 
it.  If so, this could be significantly more complex.
Troy

-- 
Troy Farrell
Developer
Entheos Software
mailto:troy@entheossoft.com
http://www.entheossoft.com


Gary Learned wrote:

> In working thru the examples in the Zope Web Applications book, it is
> demonstrating the use of python scripts. I have the following code
> elements:
> 
> myhome.html:
> 
> <dtml-let page_body="'myhome.stx'">
>   <dtml-var standard_dtml_wrapper>
> </dtml-let>
> 
> standard_dtml_wrapper:
> 
> <html>
> 	<head>
> 		<title><dtml-var title_or_id></title>
> 	</head>
> 	<body>
> 		<dtml-var banner>
> 		<dtml-call choose_page_body>
> 	</body>
> </html>
> 
> And finally, choose_page_body (type script)
> 
> from Products.PythonScripts.standard import special_formats
> 
> if page_body :
>   if page_body[-4] == ".stx" :
>     return special_formats['structured-text'](_[page_body])
>   else :
>     return _[page_body]
> else :
>   return default_page
> 
> 
> In thiscase, I also bound namespace=_
> 
> My problem is that when trying to view this, I get an error on page_body
> indicating that the python script knows nothing about it. Since this is
> all originating from within the <dtml-let> block, I thought it would
> carry thru. Since it isn't, how do I fix this?