In default.py I adjusted the def user() function:
def user():
....
form=auth()
form[0][-1]
[1].append(INPUT(_type="button",_value="Cancel",_onclick="window.location='%s';"%URL(r=request,f='index')))
return dict(form=form)
Now, when an unauthorized user tries to access a function decorated as
described above, there is a redirection to this function:
http://127.0.0.1:8000/cms/default/user/not_authorized
However, due to rewriting the user function, this results in the
following error:
Traceback (most recent call last):
File "/Library/Python/2.5/site-packages/web2py/gluon/restricted.py",
line 173, in restricted
exec ccode in environment
File "/Library/Python/2.5/site-packages/web2py/applications/cms/
controllers/default.py", line 73, in <module>
File "/Library/Python/2.5/site-packages/web2py/gluon/globals.py",
line 96, in <lambda>
self._caller = lambda f: f()
File "/Library/Python/2.5/site-packages/web2py/applications/cms/
controllers/default.py", line 30, in user
form[0][-1]
[1].append(INPUT(_type="button",_value="Cancel",_onclick="window.location='%s';"%URL(r=request,f='index')))
IndexError: string index out of range
is there a way to prevent this from happening?
Kind regards,
Annet.