[Zope] Passing namespace from DTML to Python Script

Chris Withers chrisw@nipltd.com
Thu, 24 May 2001 15:10:12 +0100


Evan Simpson wrote:
> 
> From: "Chris Withers" <chrisw@nipltd.com>
> > I want to call a python script from DTML and pass the namespace, the
> trouble is,
> > the PS needs to be called from a python expression in DTML.
> >
> > So, taking the simple DTML method:
> > <dtml-var standard_html_header>
> > <dtml-let test_thang="'Test Thang'">
> > <dtml-var "test_ps" html_quote>
> 
> Why the quotes around test_ps?

Because this is a simplification that demonstrates the problem nicely ;-)

<dtml-var "('<TD BGCOLOR=%s>&nbsp;&nbsp;</TD>' %
bgcolor(???))*(nav_indent_level-1)">

...is the real thing, where bg color is the Python Script.

The workaround I have is:
<dtml-let bgcolor=bgcolor>
<dtml-var "('<TD BGCOLOR=%s>&nbsp;&nbsp;</TD>' % bgcolor)*(nav_indent_level-1)">
</dtml-let>

...which is kinda sucky :-S

How should I be calling a python script from a python expression in DTML and
passing the namesapce in the process?

cheers,

Chris