Re: Problem with ctx.get_value

Sheila King <[email protected]> Thu, 18 Aug 2005 23:58:38 -0700
Newsgroups gmane.comp.web.albatross.general
Message-ID <787D75A362373324FB2B711C@[192.168.1.102]>
Thank you to both Andrew and Tim...

--On Wednesday, August 17, 2005 6:07 PM +1000 Andrew McNamara 
<[email protected]> wrote:

> The above doesn't really fit with what's happening. Essentially
> ctx.get_value(name) looks like (with some irrelevent steps left out):
>
>     def get_value(name):
>         return eval(name, {}, self.locals.__dict__)
>
> Somehow "formfield" must be set to "0238", rather than "year".
>
> This is what should be happening:
>
>     >>> locals={'year': '0238'}
>     >>> eval('year', {}, locals)
>     '0238'
>
> This is what it looks like is happening:
>
>     >>> eval('0238', {}, locals)
>     Traceback (most recent call last):
>       File "<stdin>", line 1, in ?
>       File "<string>", line 1
>         0238
>           ^
>     SyntaxError: invalid token

Yes, apparently BOTH of the above are happening (I find, after delving a 
bit further into the code). Still not sure why. Of course, the second one 
is what is lousing it all up.

Tim, thanks for the reminder about the octal. Now the error makes much more 
sense. I had done that eval('0238') in an interactive shell myself, and 
couldn't understand why it threw the error. Now I do. ;)

Appreciate the assistance...digging into the code deeper now...

Thanks!

-- 
Sheila King
[email protected]
http://www.thinkspot.net/sheila/