[albatross-users] Problem with ctx.get_value

Sheila King sheila at thinkspot.net
Fri Aug 19 16:58:38 EST 2005


Thank you to both Andrew and Tim...

--On Wednesday, August 17, 2005 6:07 PM +1000 Andrew McNamara 
<andrewm at object-craft.com.au> 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
sheila at thinkspot.net
http://www.thinkspot.net/sheila/





More information about the Albatross-users mailing list