[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[Freeipa-devel] [PATCH] some minor group fixes



This patch likely depends on the multi-value patch.

Fixes an error when editing a group with a single-valued cn field.

Some error messages were displaying e.detail instead of just the desc portion of that (so it was super ugly)

rob
# HG changeset patch
# User Rob Crittenden <rcritten redhat com>
# Date 1194634888 18000
# Node ID b35ec95895bc32da3fb3aac08acc815240bcb770
# Parent  de0bae564199361d01907b0c953dd2287bb36f6c
Fix editing groups when cn is a single-valued field
Fix some error messages that were printing the entire detail message

diff -r de0bae564199 -r b35ec95895bc ipa-server/ipa-gui/ipagui/subcontrollers/group.py
--- a/ipa-server/ipa-gui/ipagui/subcontrollers/group.py	Fri Nov 09 13:58:36 2007 -0500
+++ b/ipa-server/ipa-gui/ipagui/subcontrollers/group.py	Fri Nov 09 14:01:28 2007 -0500
@@ -81,7 +81,7 @@ class GroupController(IPAController):
             return dict(form=group_new_form, group=kw,
                     tg_template='ipagui.templates.groupnew')
         except ipaerror.IPAError, e:
-            turbogears.flash("Group add failed: " + str(e) + "<br/>" + str(e.detail))
+            turbogears.flash("Group add failed: " + str(e) + "<br/>" + e.detail[0]['desc'])
             return dict(form=group_new_form, group=kw,
                     tg_template='ipagui.templates.groupnew')
 
@@ -90,6 +90,8 @@ class GroupController(IPAController):
         #       on any error, we redirect to the _edit_ group page.
         #       this code does data setup, similar to groupedit()
         #
+        if isinstance(kw['cn'], str):
+            kw['cn'] = [kw['cn']]
         group = client.get_entry_by_cn(kw['cn'][0], group_fields)
         group_dict = group.toDict()
         member_dicts = []
@@ -403,7 +405,7 @@ class GroupController(IPAController):
             turbogears.flash("group deleted")
             raise turbogears.redirect('/group/list')
         except (SyntaxError, ipaerror.IPAError), e:
-            turbogears.flash("Group deletion failed: " + str(e) + "<br/>" + str(e.detail))
+            turbogears.flash("Group deletion failed: " + str(e) + "<br/>" + e.detail[0]['desc'])
             raise turbogears.redirect('/group/list')
 
     @validate(form=group_new_form)

Attachment: smime.p7s
Description: S/MIME Cryptographic Signature


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]