objects referencing the database cannot be stored unless cleaned up of
the database references. You can do it like this:
def cleanup(table,record):
import gluon.storage
return gluon.storage.Stoarge(dict([(k,record[k]) for k in
table.fields]))
session.user=cleanup(db.cas_user,r[0])
Massimo
On Feb 19, 6:15 pm, "Sebastian E. Ovide" <[email protected]>
wrote:
> Hi All,
>
> how can I store an object result from a query into the session ?
>
> I want to store the object user (and then access to all its attribute from
> anywhere in the application) rather than store its attributes individually
> (such as username, email,id)
>
> example:
>
> r=db(db.cas_user.email==form.vars.email)\
> (db.cas_user.password==form.vars.password)\
> (db.cas_user.verification=='')\
> .select()
> if len(r)>0:
> session.user=r[0]
>
> thanks
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"web2py Web Framework" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/web2py?hl=en
-~----------~----~----~----~------~----~------~--~---