fixing in 2.0.3
On Thursday, 30 August 2012 03:59:17 UTC-5, Liam wrote: > > Hi all, > > When creating a grid and no user is logged in, I get an AttributeError: > 'NoneType' object has no attribute 'user'. > > This can be recreated using vanilla web2py 2.0.2: > $ python web2py.py -S welcome -M > ... > > In [1]: SQLFORM.grid(db.auth_user) > ... > 1660 if (args != request.args and user_signature and \ > 1661 not URL.verify(request,user_signature= > user_signature)) or \ > -> 1662 (not session.auth.user and \ > 1663 ('edit' in request.args or \ > 1664 'create' in request.args or \ > > AttributeError: 'NoneType' object has no attribute 'user' > > In [2]: from gluon import current > > In [3]: current.session > Out[3]: <Storage {'auth': None}> > > I think that the grid function is using the wrong check to see if a user > is logged in. The relevant line is > not session.auth.user > > Perhaps it should be? > not session.auth > > On another much less important note, I thought the correct Pythonic way to > check for None is: > session.auth is None > ;) > > Cheers, > Liam > --