[Zope] Keeping a Variable's Value: This SHOULD Be Easy
Mike Renfro
renfro@tntech.edu
Tue, 30 Oct 2001 13:52:56 -0600
On Tue, Oct 30, 2001 at 11:38:37AM -0800, Ben Ocean wrote:
> ...but apparently it's not. If I were writing this in PHP:
> <? x = int mt_rand(0,9); echo x ?>
> <? echo x ?>
> ...but apparently DTML *does* forget.
I assume you're setting your random variable value inside a
double-quoted expression along the lines of <dtml-var
"foo=_.random()"> or similar. If so, remember that every invocation of
the double-quotes is a new Python call, with its own (mostly
read-only) copy of the available namespace.
Unless you modify the existing namespace via something like <dtml-call
"REQUEST.set(foo,_.random())">, foo simply won't be available later in
the object.
I may completely misunderstand the question, but I think that's what
you're asking.
--
Mike Renfro / R&D Engineer, Center for Manufacturing Research,
931 372-3601 / Tennessee Technological University -- renfro@tntech.edu