mirror of
https://github.com/kakwa/ldapcherry
synced 2024-11-22 09:24:21 +01:00
adding more try catch for template debugging
This commit is contained in:
parent
819e575a28
commit
3a1966324d
@ -1051,26 +1051,31 @@ class LdapCherry(object):
|
|||||||
for r in self.roles.flatten:
|
for r in self.roles.flatten:
|
||||||
display_names[r] = self.roles.flatten[r]['display_name']
|
display_names[r] = self.roles.flatten[r]['display_name']
|
||||||
roles_js = json.dumps(display_names, separators=(',', ':'))
|
roles_js = json.dumps(display_names, separators=(',', ':'))
|
||||||
form = self.temp['form.tmpl'].render(
|
try:
|
||||||
attributes=self.attributes.attributes,
|
form = self.temp['form.tmpl'].render(
|
||||||
values=None,
|
attributes=self.attributes.attributes,
|
||||||
modify=False,
|
values=None,
|
||||||
autofill=True
|
modify=False,
|
||||||
)
|
autofill=True
|
||||||
roles = self.temp['roles.tmpl'].render(
|
)
|
||||||
roles=self.roles.flatten,
|
roles = self.temp['roles.tmpl'].render(
|
||||||
graph=self.roles.graph,
|
roles=self.roles.flatten,
|
||||||
graph_js=graph_js,
|
graph=self.roles.graph,
|
||||||
roles_js=roles_js,
|
graph_js=graph_js,
|
||||||
current_roles=None,
|
roles_js=roles_js,
|
||||||
)
|
current_roles=None,
|
||||||
return self.temp['adduser.tmpl'].render(
|
)
|
||||||
form=form,
|
return self.temp['adduser.tmpl'].render(
|
||||||
roles=roles,
|
form=form,
|
||||||
is_admin=is_admin,
|
roles=roles,
|
||||||
custom_js=self.custom_js,
|
is_admin=is_admin,
|
||||||
notifications=self._empty_notification(),
|
custom_js=self.custom_js,
|
||||||
)
|
notifications=self._empty_notification(),
|
||||||
|
)
|
||||||
|
except NameError:
|
||||||
|
raise TemplateRenderError(
|
||||||
|
exceptions.text_error_template().render()
|
||||||
|
)
|
||||||
|
|
||||||
@cherrypy.expose
|
@cherrypy.expose
|
||||||
@exception_decorator
|
@exception_decorator
|
||||||
@ -1203,20 +1208,27 @@ class LdapCherry(object):
|
|||||||
"Self modification done"
|
"Self modification done"
|
||||||
)
|
)
|
||||||
user_attrs = self._get_user(user)
|
user_attrs = self._get_user(user)
|
||||||
if user_attrs == {}:
|
|
||||||
return self.temp['error.tmpl'].render(
|
try:
|
||||||
is_admin=is_admin,
|
if user_attrs == {}:
|
||||||
alert='warning',
|
return self.temp['error.tmpl'].render(
|
||||||
message="User doesn't exist"
|
is_admin=is_admin,
|
||||||
|
alert='warning',
|
||||||
|
message="User doesn't exist"
|
||||||
|
)
|
||||||
|
|
||||||
|
form = self.temp['form.tmpl'].render(
|
||||||
|
attributes=self.attributes.get_selfattributes(),
|
||||||
|
values=self._escape(user_attrs, 'attr_list'),
|
||||||
|
modify=True,
|
||||||
|
autofill=False
|
||||||
)
|
)
|
||||||
form = self.temp['form.tmpl'].render(
|
return self.temp['selfmodify.tmpl'].render(
|
||||||
attributes=self.attributes.get_selfattributes(),
|
form=form,
|
||||||
values=self._escape(user_attrs, 'attr_list'),
|
is_admin=is_admin,
|
||||||
modify=True,
|
notifications=self._empty_notification(),
|
||||||
autofill=False
|
)
|
||||||
)
|
except NameError:
|
||||||
return self.temp['selfmodify.tmpl'].render(
|
raise TemplateRenderError(
|
||||||
form=form,
|
exceptions.text_error_template().render()
|
||||||
is_admin=is_admin,
|
)
|
||||||
notifications=self._empty_notification(),
|
|
||||||
)
|
|
||||||
|
Loading…
Reference in New Issue
Block a user