forked from moepman/bk-dss
Improve error handling.
Some LDAPErrors might not contain a info or desc value, only add them tothe message if they exist.
This commit is contained in:
parent
46e560cef9
commit
9669790224
7
index.py
7
index.py
@ -105,7 +105,12 @@ def create():
|
|||||||
|
|
||||||
except ldap.LDAPError as e:
|
except ldap.LDAPError as e:
|
||||||
l.unbind_s()
|
l.unbind_s()
|
||||||
return render_template('error.html', message=e.message['desc'] + ": " + e.message['info'], nav=buildNav())
|
message = "LDAP Error"
|
||||||
|
if 'desc' in e.message:
|
||||||
|
message = message + " " + e.message['desc']
|
||||||
|
if 'info' in e.message:
|
||||||
|
message = message + ": " + e.message['info']
|
||||||
|
return render_template('error.html', message=message, nav=buildNav())
|
||||||
else:
|
else:
|
||||||
l.unbind_s()
|
l.unbind_s()
|
||||||
return render_template('success.html', message="User successfully created.", nav=buildNav())
|
return render_template('success.html', message="User successfully created.", nav=buildNav())
|
||||||
|
Loading…
Reference in New Issue
Block a user