Hi! I'm developing a simple way form logging and registering using web.py. I had done a proccesor to check if the user is logged or not and to set in web.ctx the user id:
def auth_app_processor(handle): path = web.ctx.path web.ctx.session = web.session.Session(app,web.session.DiskStore(os.path.dirname(__file__) +'/sessions')) try: web.ctx.idusr = idusr = web.ctx.session.idusr except: web.ctx.idusr = idusr=0 if idusr!=0 and (path == '/' or path == '/register'): raise web.seeother('/'+entry[0].url+'/') #elif idusr==0 and not (path=='/' or path == '/register'): #raise web.seeother('/') return handle() Register a new user, runs without any problem. But, when I try log in, it brokes. >From error.log: [Wed Feb 16 13:37:28 2011] [error] [client 127.0.1.1] if(web.ctx.idusr!=0):, referer: http://127.0.1.1/grapevine/ [Wed Feb 16 13:37:28 2011] [error] [client 127.0.1.1] File "/var/lib/ python-support/python2.5/web/utils.py", line 1165, in __getattr__, referer: http://127.0.1.1/grapevine/ [Wed Feb 16 13:37:28 2011] [error] [client 127.0.1.1] return getattr(self._getd(), key), referer: http://127.0.1.1/grapevine/ [Wed Feb 16 13:37:28 2011] [error] [client 127.0.1.1] File "/var/lib/ python-support/python2.5/web/utils.py", line 71, in __getattr__, referer: http://127.0.1.1/grapevine/ [Wed Feb 16 13:37:28 2011] [error] [client 127.0.1.1] raise AttributeError, k, referer: http://127.0.1.1/grapevine/ [Wed Feb 16 13:37:28 2011] [error] [client 127.0.1.1] AttributeError: 'idusr', referer: http://127.0.1.1/grapevine/ And, the class (wich is in a different module than de proccesor and the web app): session = web.ctx.session class profile: def GET(self,url): if(web.ctx.idusr!=0): entry = db.select(tables['users'],where=('id='+session.idusr+' AND url="'+url +'" AND idstatus=1')) if len(entry)>0: return render.profile(entry) else: raise web.seeother('/'+logout) else: raise web.seeother('/'+logout) Anyone can help me? Thanks in advance. Excuse my bad english, plis. -- You received this message because you are subscribed to the Google Groups "web.py" group. To post to this group, send email to webpy@googlegroups.com. To unsubscribe from this group, send email to webpy+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/webpy?hl=en.