summaryrefslogtreecommitdiffstats
path: root/ipa-server/ipa-gui/ipagui
diff options
context:
space:
mode:
authorKevin McCarthy <kmccarth@redhat.com>2007-08-22 10:30:51 -0700
committerKevin McCarthy <kmccarth@redhat.com>2007-08-22 10:30:51 -0700
commit7691653c0a3ee95aab7c64d631c694a300547345 (patch)
treed1d3018438cc2b4abdc0b24c2751b85028e96e76 /ipa-server/ipa-gui/ipagui
parenta8f302aa9f193984d68318a65a51b41298b1391d (diff)
downloadfreeipa-7691653c0a3ee95aab7c64d631c694a300547345.tar.gz
freeipa-7691653c0a3ee95aab7c64d631c694a300547345.tar.xz
freeipa-7691653c0a3ee95aab7c64d631c694a300547345.zip
Create ipaerror module.
Move LDAPError trapping/conversion into the ipaldap module. Fix xmlrpc layer to encode/decode ipaerrors properly. Also, implement mid-air collision exception for updates.
Diffstat (limited to 'ipa-server/ipa-gui/ipagui')
-rw-r--r--ipa-server/ipa-gui/ipagui/controllers.py17
1 files changed, 9 insertions, 8 deletions
diff --git a/ipa-server/ipa-gui/ipagui/controllers.py b/ipa-server/ipa-gui/ipagui/controllers.py
index bbe0f5d48..eb89e5a6c 100644
--- a/ipa-server/ipa-gui/ipagui/controllers.py
+++ b/ipa-server/ipa-gui/ipagui/controllers.py
@@ -17,6 +17,7 @@ import ipa.ipaclient
import ipa.user
import xmlrpclib
import forms.user
+from ipa import ipaerror
ipa.config.init_config()
user_new_form = forms.user.UserNewForm()
@@ -80,8 +81,8 @@ class Root(controllers.RootController):
rv = client.add_user(new_user)
turbogears.flash("%s added!" % kw['uid'])
raise turbogears.redirect('/usershow', uid=kw['uid'])
- except xmlrpclib.Fault, f:
- turbogears.flash("User add failed: " + str(f.faultString))
+ except ipaerror.IPAError, e:
+ turbogears.flash("User add failed: " + str(e))
return dict(form=user_new_form, tg_template='ipagui.templates.usernew')
@@ -129,8 +130,8 @@ class Root(controllers.RootController):
rv = client.update_user(new_user)
turbogears.flash("%s updated!" % kw['uid'])
raise turbogears.redirect('/usershow', uid=kw['uid'])
- except xmlrpclib.Fault, f:
- turbogears.flash("User update failed: " + str(f.faultString))
+ except ipaerror.IPAError, e:
+ turbogears.flash("User update failed: " + str(e))
return dict(form=user_edit_form, user=kw,
tg_template='ipagui.templates.useredit')
@@ -143,8 +144,8 @@ class Root(controllers.RootController):
if uid != None and len(uid) > 0:
try:
users = client.find_users(uid.encode('utf-8'))
- except xmlrpclib.Fault, f:
- turbogears.flash("User show failed: " + str(f.faultString))
+ except ipaerror.IPAError, e:
+ turbogears.flash("User show failed: " + str(e))
raise turbogears.redirect("/userlist")
return dict(users=users, fields=forms.user.UserFields())
@@ -156,8 +157,8 @@ class Root(controllers.RootController):
try:
user = client.get_user(uid)
return dict(user=user.toDict(), fields=forms.user.UserFields())
- except xmlrpclib.Fault, f:
- turbogears.flash("User show failed: " + str(f.faultString))
+ except ipaerror.IPAError, e:
+ turbogears.flash("User show failed: " + str(e))
raise turbogears.redirect("/")
@validate(form=user_new_form)