[web2py] Re: GAE - DAL problem

2011-09-28 Thread Massimo Di Pierro
It is not finding the record db.auth_group(description=Teacher)
Not sure it is a dal problem,

On Sep 28, 2:50 pm, felixdm joi@gmail.com wrote:
 I have this problem in GAE

 Traceback (most recent call last):
   File /base/data/home/apps/s~book-on/1.353593485285740911/gluon/
 restricted.py, line 194, in restricted
     exec ccode in environment
   File /base/data/home/apps/s~book-on/1.353593485285740911/
 applications/bookon/controllers/default.py:user, line 204, in
 module
   File /base/data/home/apps/s~book-on/1.353593485285740911/gluon/
 globals.py, line 149, in lambda
     self._caller = lambda f: f()
   File /base/data/home/apps/s~book-on/1.353593485285740911/
 applications/bookon/controllers/default.py:user, line 149, in user
 AttributeError: 'NoneType' object has no attribute 'id'

                 if request.args(0)==register:
                         if not request.args(1) or (request.args(1)!=teacher 
 and
 request.args(1)!=student and request.args(1)!=institution):
                                 redirect(URL(r=request,c='default',f='index'))

 form=SQLFORM(db.auth_user,fields=['fullname','email','password','username'] 
 ,formstyle='divs')

                         if form.accepts(request.vars, session, dbio=True):

                                 if request.args(1)==teacher:

                                         tid = 
 db.auth_group(description=Teacher).id             - 149
 NoneType DAL problem?
                                         username_id = 
 db.auth_user(username=request.vars['username']).id
                                         auth.add_membership( tid , 
 username_id)


Re: [web2py] Re: GAE - DAL problem

2011-09-28 Thread Felixdm || Augusto Félix Dal Mas
Ok but if the record exist
http://imageshack.us/f/198/dbgroup.png/

only if i do this the problem is fixed
if i change for this
if request.args(1)==teacher:
username_id = 
db.auth_user(username=request.vars['username']).id
auth.add_membership( 5005 = HERE , 
username_id)


but i cant do the same in this way

if request.args(1)==teacher:
# tid=db.auth_group(description=Teacher)
# tid=db.auth_group(role=teacher)

username_id = db.auth_user(username=request.vars['username']).id
auth.add_membership( tid , username_id)










On Wed, Sep 28, 2011 at 5:37 PM, Massimo Di Pierro
massimo.dipie...@gmail.com wrote:
 It is not finding the record db.auth_group(description=Teacher)
 Not sure it is a dal problem,

 On Sep 28, 2:50 pm, felixdm joi@gmail.com wrote:
 I have this problem in GAE

 Traceback (most recent call last):
   File /base/data/home/apps/s~book-on/1.353593485285740911/gluon/
 restricted.py, line 194, in restricted
     exec ccode in environment
   File /base/data/home/apps/s~book-on/1.353593485285740911/
 applications/bookon/controllers/default.py:user, line 204, in
 module
   File /base/data/home/apps/s~book-on/1.353593485285740911/gluon/
 globals.py, line 149, in lambda
     self._caller = lambda f: f()
   File /base/data/home/apps/s~book-on/1.353593485285740911/
 applications/bookon/controllers/default.py:user, line 149, in user
 AttributeError: 'NoneType' object has no attribute 'id'

                 if request.args(0)==register:
                         if not request.args(1) or 
 (request.args(1)!=teacher and
 request.args(1)!=student and request.args(1)!=institution):
                                 
 redirect(URL(r=request,c='default',f='index'))

 form=SQLFORM(db.auth_user,fields=['fullname','email','password','username'] 
 ,formstyle='divs')

                         if form.accepts(request.vars, session, dbio=True):

                                 if request.args(1)==teacher:

                                         tid = 
 db.auth_group(description=Teacher).id             - 149
 NoneType DAL problem?
                                         username_id = 
 db.auth_user(username=request.vars['username']).id
                                         auth.add_membership( tid , 
 username_id)


[web2py] Re: GAE - DAL problem

2011-09-28 Thread Massimo Di Pierro
This does not prove that you have a record auth_group with
description='Teacher'. Perhaps your record has description='Teacher
\n'?


Re: [web2py] Re: GAE - DAL problem

2011-09-28 Thread Felixdm || Augusto Félix Dal Mas
=D I fix it

Now I'm using role no more description
tid = db.auth_group(role='Teacher').id
http://imageshack.us/f/28/screenshot1gvq.png/

But i dont know how select description any way or if the problem was
the read/write property of description
http://imageshack.us/f/51/screenshot2uy.png/


On Wed, Sep 28, 2011 at 8:20 PM, Massimo Di Pierro
massimo.dipie...@gmail.com wrote:
 This does not prove that you have a record auth_group with
 description='Teacher'. Perhaps your record has description='Teacher
 \n'?