[Zope] - namespace problem

Richard Jones richard.jones@fulcrum.com.au
Thu, 31 Dec 1998 14:51:11 +1100


[Richard Jones]
> 
> The following DTML does not work:
> 
> <!--#if foo-->
>  <p>foo found!
> <!--#else-->
>  <!--#call "_.namespace(foo=1)"-->
>  <p>foo inserted! <!--#var foo-->
> <!--#/if-->
> 
>    It barfs with a NameError on foo. If I change the #call to a #with and use
>  
> that to enclose the #var foo, then it works. I'd like to suggest that the 
> description of the _.namespace function in the DTML reference include the 
> return value (ie. "it returns a new namespace to be used in a #with" or 
> somesuch).
> 
>    Given that the #call and _.namespace combination aren't going to do what I
>  
> want to do, how can I do it? I've also tried REQUEST.set() but couldn't get 
> that to work at all.

My apologies, the following _does_ work:

<!--#if foo-->
 <p>foo found!
<!--#else-->
 <!--#call "REQUEST.set('foo', 1)"-->
 <p>foo inserted! <!--#var foo-->
<!--#/if-->


     Richard