[Zope] Proper way to set variables

John Goerzen jgoerzen@complete.org
08 Sep 1999 14:02:48 -0500


Heh, feels strange to reply to myself, but as I got no replies before, 
maybe I need to elaborate a bit.  The original question is below.

My main confusion is just how do I set a variable that is dynamically
scoped without having to use dtml-with or dtml-let, both of which
require matching closing tags?

the REQUEST.set was used, but for some reason, when calling some
functions, it would suddenly disappear and an error would result.  So
I am completely puzzled about it.

Thanks,
John

John Goerzen <jgoerzen@complete.org> writes:

> Hi,
> 
> I have a method that is called as part of the branches_expr of a tree
> tag.  (Thanks for the pointer to dtml-return, BTW!)
> 
> I have a problem.  I have some parameters to this method that I want
> to be optional.  I was testing for them with dtml-if, and then calling
> REQUEST.set  to set them to an appropriate value if they were not passed
> in to this DTML method.
> 
> This seemed to work.  However, when this was called from within the
> tree tag, for some reason, it complains that REQUEST is not set.  I have
> tried every way I can think of to pass in both REQUEST and _, to no avail.
> 
> My only other way that I know to set these things is with dtml-with,
> but since this is only called in some cases, there is a scoping problem;
> the closing tag would have to occur after the /dtml-if.  So, this is out.
> 
> I guess I have several questions:
> 
>  * What's the solution to this particular problem?
> 
>  * What's the preferred way to create or set variables in DTML?
> 
>  * Why does REQUEST sometimes disappear?
> 
> I understand the search logic just fine (this is nicely explained in
> the DTML book).  But, it seems to be ignored; why is REQUEST no longer
> present, and what can be done to remedy it?
> 
> Thanks,
> 
> John Goerzen
> 
> _______________________________________________
> Zope maillist  -  Zope@zope.org
> http://www.zope.org/mailman/listinfo/zope
> 
> (To receive general Zope announcements, see:
> http://www.zope.org/mailman/listinfo/zope-announce
> 
> For developer-specific issues, zope-dev@zope.org -
> http://www.zope.org/mailman/listinfo/zope-dev )
> 

-- 
John Goerzen   Linux, Unix consulting & programming   jgoerzen@complete.org |
Developer, Debian GNU/Linux (Free powerful OS upgrade)       www.debian.org |
----------------------------------------------------------------------------+
The 11,979,300th prime number is 217,247,021.