Not completely sure but 

auth.environment.session.auth = ...

should be

session.auth = ...

since auth.environment does not exist any more.


On Wednesday, 4 April 2012 07:53:50 UTC-5, bussiere adrien wrote:
>
> i truly don't understand ....
> it seems to work before at my last commit and now i have a bug :
>
> 127.0.0.1.2012-04-04.14-49-48.50c46aad-96a9-4d70-9b67-009e81ed17f0
> <type 'exceptions.KeyError'> 'User'
>
> Traceback (most recent call last):
>   File "gluon/restricted.py", line 205, in restricted
>   File 
> "C:/Users/Bussiere/Dropbox/Projets/jackpoint/web2py/applications/init/controllers/default.py"
>  <http://localhost:8000/admin/default/edit/init/controllers/default.py> , 
> line 749, in <module>
>   File "gluon/globals.py", line 173, in <lambda>
>   File 
> "C:/Users/Bussiere/Dropbox/Projets/jackpoint/web2py/applications/init/controllers/default.py"
>  <http://localhost:8000/admin/default/edit/init/controllers/default.py> , 
> line 686, in invitation
>   File "gluon/dal.py", line 6683, in _filter_fields
>   File "gluon/dal.py", line 6478, in __getattr__
>   File "gluon/dal.py", line 6471, in __allocate
>   File "gluon/dal.py", line 6712, in __getitem__
>   File "gluon/dal.py", line 7578, in select
>   File "gluon/dal.py", line 1320, in select
>   File "gluon/dal.py", line 1624, in parse
>   File "gluon/dal.py", line 6714, in __getitem__
> KeyError: 'User'
>
>
>
> here si my code :
>
>
>
> def invitation():
>     form=FORM("Code Invitation :", INPUT(_name='invitation'),"<Email 
> :",INPUT(_name='email'),  INPUT(_type='submit'))
>     if form.process(onvalidation=verif_invitation).accepted and  
> form.vars.invitation != None  :
>         email = form.vars.email
>         if db(db.auth_user.email == email).count() == 0:
>             password= form.vars.invitation  
>             my_crypt = CRYPT(key=auth.settings.hmac_key)
>             crypt_pass = my_crypt(password)[0]  
>             john = db.auth_user.insert(
>                email= email,
>                username="John_Doe",
>                password=crypt_pass,
>                invitation = form.vars.invitation,
>             )
>             db.commit()  
>
>
>             auth.user = Storage(auth.settings.table_user._filter_fields(john, 
> id=True))
>
> #line 686 where the bug is ????????????????
>             auth.environment.session.auth = Storage(user=john, 
> last_visit=request.now,
>                                                 
> expiration=auth.settings.expiration)
>             redirect(URL('inscriptioninvit'))
>     return dict(form=form)
>
>

Reply via email to