Reference post: Scope authenticated users in accounts https://groups.google.com/group/web2py/browse_thread/thread/4e2bfa3f4b0911a5/0fef76dbec18829c
I used fishwebby's method to scope authenticated users. The code used is: >> db._request_tenant = 'account_id' >> db._common_fields=[Field('account_id',default=session.account.id, >> writable=False, readable=False)] But I get this error: AttributeError: 'NoneType' object has no attribute 'id' When I change default to session.account, >> db._common_fields=[Field('account_id',default=session.account, >> writable=False, readable=False)] It doesn't give error, but when I use session.account.id or session.account['id'] the error comes back. Because session.account holds all the account info, it is better than just to have the id in session.account. Is this a bug or must I use session.account to hold only the account id? Or to solve this another way: How can I create an accessible "account" variable like "auth", so that I can use default=account.id or default=auth.account_id? Thanks.