mirror of
https://github.com/kakwa/ldapcherry
synced 2024-11-22 09:24:21 +01:00
fix decorator handling the exceptions
This commit is contained in:
parent
2992cac1d7
commit
1fd76a9485
@ -235,7 +235,7 @@ def exception_decorator(func):
|
|||||||
et = type(e)
|
et = type(e)
|
||||||
if et is UserDoesntExist:
|
if et is UserDoesntExist:
|
||||||
user = e.user
|
user = e.user
|
||||||
return self.temp_error.render(
|
return self.temp['error.tmpl'].render(
|
||||||
is_admin=is_admin,
|
is_admin=is_admin,
|
||||||
alert='danger',
|
alert='danger',
|
||||||
message="User '" + user + "' does not exist"
|
message="User '" + user + "' does not exist"
|
||||||
@ -243,20 +243,20 @@ def exception_decorator(func):
|
|||||||
elif et is UserAlreadyExists:
|
elif et is UserAlreadyExists:
|
||||||
user = e.user
|
user = e.user
|
||||||
cherrypy.response.status = 400
|
cherrypy.response.status = 400
|
||||||
return self.temp_error.render(
|
return self.temp['error.tmpl'].render(
|
||||||
is_admin=is_admin,
|
is_admin=is_admin,
|
||||||
alert='warning',
|
alert='warning',
|
||||||
message="User '" + user + "' already exist"
|
message="User '" + user + "' already exist"
|
||||||
)
|
)
|
||||||
elif et is GroupDoesntExist:
|
elif et is GroupDoesntExist:
|
||||||
group = e.group
|
group = e.group
|
||||||
return self.temp_error.render(
|
return self.temp['error.tmpl'].render(
|
||||||
is_admin=is_admin,
|
is_admin=is_admin,
|
||||||
alert='danger',
|
alert='danger',
|
||||||
message="Missing group, please check logs for details"
|
message="Missing group, please check logs for details"
|
||||||
)
|
)
|
||||||
else:
|
else:
|
||||||
return self.temp_error.render(
|
return self.temp['error.tmpl'].render(
|
||||||
is_admin=is_admin,
|
is_admin=is_admin,
|
||||||
alert='danger',
|
alert='danger',
|
||||||
message="An error occured, please check logs for details"
|
message="An error occured, please check logs for details"
|
||||||
|
Loading…
Reference in New Issue
Block a user