Notice the subtle distinction in the messages here. auth.user.id -- this is the global variable 'auth' which has a variable named 'user' which in turn has a named variable called 'id'. This variable is valid only after a user is logged on and it refers to the id of the current user. If no one is logged in, auth.user does not exist and has the value of 'None'. But None has no named variable 'id' so you get an error if you try to use it.
db.auth_user.id -- this is a global SQLField definition contained in the 'auth_user' table named 'id'. This is a field definition and it valid whether or not anyone is logged in at the moment. It refers to a column of a table and can't sit on the right-hand side of '==' since it does not have a single value but refers to a column in a table. Details upon details... These should go in a wiki somewhere... ;-) On Mar 4, 3:12 pm, Kuba Kucharski <[email protected]> wrote: > When I do smth like that in my db.py: > > db.sipusers.owner_id.requires=IS_IN_DB(db(db.sipusers.owner_id==auth.user.id > ),'auth_user.id','auth_user.name') > > I get: > > AttributeError: 'NoneType' object has no attribute 'id' > > the same: > > db.sipusers.owner_id.requires=IS_IN_DB(db(db.sipusers.owner_id==t2.person_id),' > auth_user.id','auth_user.name') > > worked with T2. what do I miss? > > Same happens when I try to use auth.user.id in controller. > > I'm trying to rewrite my app for use with new tools, now it is T2 based. I > would like not to do that, but higher abstraction level plugins seems not to > be priority anymore;) > > or maybe.. > > I should stay with t2? it feels like new tools are more powerfull in > groups/memberships/access management or am I completely wrong and t2 does > exactly the same job in that area? In other words, is T2 in any possible way > deprecated? > > -- > Kuba --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---

