Should have been:

a = db.auth_user(username = 'admin')

On Tuesday, 4 February 2014 08:59:04 UTC-6, Boris Aguilar wrote:
>
> In web2py~2.6 i used to rely on the following to check if an 
> administrative user existed in database:
>
> a = db.auth_user(db.auth_user.username == 'admin') if a was None then the 
> user wasn't in the database
>
> Now in latest version 2.8.2-stable+timestamp.2013.11.28.13.54.07 I'm 
> getting a type error exception:
>
> <type 'exceptions.TypeError'> 'NoneType' object is not iterable
>
> Traceback (most recent call last):
>   File "/home/boris/Work/deploy-web2py-local/gluon/restricted.py", line 217, 
> in restricted
>     exec ccode in environment
>   File 
> "/home/boris/Work/deploy-web2py-local/applications/cpfecys/models/db.py" 
> <http://127.0.0.1:8000/admin/default/edit/cpfecys/models/db.py>, line 70, in 
> <module>
>     a = db.auth_user(db.auth_user.username == 'admin')
>   File "/home/boris/Work/deploy-web2py-local/gluon/dal.py", line 8829, in 
> __call__
>     limitby=(0,1),for_update=for_update, orderby=orderby, 
> orderby_on_limitby=False).first()
>   File "/home/boris/Work/deploy-web2py-local/gluon/dal.py", line 10335, in 
> select
>     return adapter.select(self.query,fields,attributes)
>   File "/home/boris/Work/deploy-web2py-local/gluon/dal.py", line 1831, in 
> select
>     return self._select_aux(sql,fields,attributes)
>   File "/home/boris/Work/deploy-web2py-local/gluon/dal.py", line 1812, in 
> _select_aux
>     return processor(rows,fields,self._colnames,cacheable=cacheable)
>   File "/home/boris/Work/deploy-web2py-local/gluon/dal.py", line 2173, in 
> parse
>     for (i,row) in enumerate(rows):
> TypeError: 'NoneType' object is not iterable
>
>

-- 
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 [email protected].
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to