locals() returns the variables in the current namespace -- in the shell, 
that is the global web2py environment, which includes the web2py API 
objects, but in a controller function, it is just the function's namespace. 
You could do f=locals()['IS_IN_SET'] outside a function (e.g., in a model 
or at the top level in a controller), or instead you could do 
globals()['IS_IN_SET'] within a function.

Anthony

On Monday, February 18, 2013 11:09:50 PM UTC-5, Tim Richardson wrote:
>
> When in interactive mode (python web2py.py -S welcome)
> I can do this:
> f = local()['IS_IN_SET']
> and I get f as a function variable.
>
> But the same thing in a controller fails with a KeyError. 
>
> [I'm trying to make an SQLFORM.factory form based on queries defined in a 
> table, with SQL, parameters and validation for the parameters]
>
> python 2.7.2 on Windows 
>
>
>
>

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to