[Zope] name error : global name 'day' is not defined

Joel Burton joel@joelburton.com
Tue, 19 Mar 2002 12:36:39 -0500


> Hi,
>
> One of my major problems in using zope now is to store value in a var
> for future use.
>
> I was able to get value for variable 'day' from my table through
> this:
>
> <dtml-in SQLgetDay>
>        <dtml-call "REQUEST.set('day', day)">
>        <dtml-var day>
> </dtml-in>
>
> This actually displayed the value of day with <dtml-var day> on this
> page.
>
> Meanwhile it keeps on giving me the error below each time I reffered
> to 'day' subseqeuently. Even though I defined cookies for variable
> 'day' which I called from the standard-html-header of those pages
> where 'day' is been refferenced.
>
> Error Type: NameError
> Error Value: global name 'day' is not defined.
>
> Kindly tell me what i am doing wrong.

Hamzal --

First of all, your code above could simply be:

<dtml-in SQLgetDay>
  <dtml-var day>
</dtml-in>

No need to put day in the REQUEST object unless you want to use it outside
the <dtml-in> loop.


When you say that you want to use it subsequently, it sounds like you mean
on different web requests, so, yes, setting it as a cookie (or in Zope 2.5,
as a SESSION variable) would be the right approach.

Can you post the complete code to how you're setting it as a cookie and how
you're trying to read it?


- Joel