There is a bug, I just fixed it in trunk. auth.impersonate(0) is correct.
On Tuesday, 16 October 2012 04:38:35 UTC-5, mweissen wrote: > > I have called > auth.impersonate(0) > to finish impersonation. > > Now (Version 2.1.1) I see: > > Traceback (most recent call last): > File "H:\...\web2py\gluon\restricted.py", line 209, in restricted > > > exec ccode in environment > File "H:/.../applications/secure/controllers/default.py" > <http://127.0.0.1:8000/admin/default/edit/secure/controllers/default.py>, > line 3988, in <module> > > > File "H:\...\web2py\gluon\globals.py", line 187, in <lambda> > > > self._caller = lambda f: f() > > > File "H:/.../applications/secure/controllers/default.py" > <http://127.0.0.1:8000/admin/default/edit/secure/controllers/default.py>, > line 1932, in impersonateEnd > > > auth.impersonate(0) > File "H:\...\web2py\gluon\tools.py", line 2755, in impersonate > > > return SQLFORM(table_user, user.id, readonly=True) > > UnboundLocalError: local variable 'user' referenced before assignment > > > My function: > def impersonateEnd(): > auth.impersonate(0) > redirect(URL('index',vars=dict(flash=T('End of impersonation')))) > > What ist the best way to end impersonation? > > Regards, Martin > --