Improve exception handling
This commit is contained in:
parent
d4c47073e0
commit
5a504220aa
|
@ -115,14 +115,14 @@ class EndPage(WizardPanel):
|
||||||
for group in data['groups']:
|
for group in data['groups']:
|
||||||
try:
|
try:
|
||||||
members.change_group_member(action, group, self.state['userid'])
|
members.change_group_member(action, group, self.state['userid'])
|
||||||
except:
|
except ldap.LDAPError:
|
||||||
failed.append(group)
|
failed.append(group)
|
||||||
if len(failed) == 0:
|
if len(failed) == 0:
|
||||||
self.headtext.set_text("%s succeeded" % data['action'])
|
self.headtext.set_text("%s succeeded" % data['action'])
|
||||||
self.midtext.set_text("Congratulations, the group modification "
|
self.midtext.set_text("Congratulations, the group modification "
|
||||||
"has succeeded.")
|
"has succeeded.")
|
||||||
else:
|
else:
|
||||||
self.headtext.set_text("%s partially succeeded" % data['action'])
|
self.headtext.set_text("%s Results" % data['action'])
|
||||||
self.midtext.set_text("Failed to %s member to %s for the "
|
self.midtext.set_text("Failed to %s member to %s for the "
|
||||||
"following groups: %s. This may indicate an attempt to add a "
|
"following groups: %s. This may indicate an attempt to add a "
|
||||||
"duplicate group member or to delete a member that was not in "
|
"duplicate group member or to delete a member that was not in "
|
||||||
|
|
|
@ -76,11 +76,20 @@ class EndPage(WizardPanel):
|
||||||
def focusable(self):
|
def focusable(self):
|
||||||
return False
|
return False
|
||||||
def activate(self):
|
def activate(self):
|
||||||
|
failed = []
|
||||||
for (position, info) in self.state['positions'].iteritems():
|
for (position, info) in self.state['positions'].iteritems():
|
||||||
members.set_position(position, info)
|
try:
|
||||||
self.headtext.set_text("Positions Updated")
|
members.set_position(position, info)
|
||||||
self.midtext.set_text("Congratulations, positions have been updated. "
|
except ldap.LDAPError:
|
||||||
"You should rebuild the website in order to update the Positions "
|
failed.append(position)
|
||||||
"page.")
|
if len(failed) == 0:
|
||||||
|
self.headtext.set_text("Positions Updated")
|
||||||
|
self.midtext.set_text("Congratulations, positions have been "
|
||||||
|
"updated. You should rebuild the website in order to update "
|
||||||
|
"the Positions page.")
|
||||||
|
else:
|
||||||
|
self.headtext.set_text("Positions Results")
|
||||||
|
self.midtext.set_text("Failed to update the following positions: "
|
||||||
|
"%s." % join(failed))
|
||||||
def check(self):
|
def check(self):
|
||||||
pop_window()
|
pop_window()
|
||||||
|
|
Loading…
Reference in New Issue