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)

Reply via email to