any help ?

2017-07-20 22:45 GMT+01:00 António Ramos <ramstei...@gmail.com>:

> hello i tested this simple code outside web2py
>
> class a():
>     def a1(self):
>         temp=getattr(eval("b")(), "b1")('testing result')
>         return temp
>
> class b():
>     def b1(self,param):
>        * s=somevar2.somesubvar1*
>         return param
>
> print a().a1()
>
>
> if i remove *s=somevar2.somesubvar1* the code prints "'testing result'"
> otherwise i get this error
> global name 'somevar2' is not defined
>
>
> I´m using this kind of code with virtual fields like this
> *db.py*
> from wf_validates import Validate
> db.define_table(
> "status",
> ...
> Field.Virtual('isavailable', lambda row: Validate().status('status','
> isavailable',row,db)),
>
> )
>
> *wf_validates.py*
>
> class Validate(object):
>
>
> def status(self,table,field,row,db):
> wf=db.workflows(id=row[table]["workflow"])["workflow"]
> cb=getattr(eval(wf)(), table+"_"+row[table]["title"].replace("
> ","_"))('xx',db)
> return cb
>
> class Ficheiros(object):
> def status_Draft(self,row,db):
> *session=current.session*
> return True
>
> here session=current.session is the offending line probably because
> session is not available.
> So far so good.
> The problem is that it does not throw any error and i was chasing it for
> too many time until i discovered it because the field "isavailable" was not
> created but the row object was created.
>
> Why web2py does not generate an admin error with
>
> *global name 'session' is not defined  ???*
>
> Regards
>
>
>
>
>
>
>
>
>
>
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
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/d/optout.

Reply via email to