[Freeipa-devel] [PATCH] add validation message to top

Kevin McCarthy kmccarth at redhat.com
Fri Oct 19 16:01:42 UTC 2007


Add a message to the top of the page when there are validation errors.

-Kevin

-------------- next part --------------
# HG changeset patch
# User Kevin McCarthy <kmccarth at redhat.com>
# Date 1192809580 25200
# Node ID ced99337e0e07aa24ae1ac31d6cf3125d74511c7
# Parent  508a76cb47774438125c4861e5d9dac599266fc3
Add a flash message to the top of the page when there are validation errors.

diff -r 508a76cb4777 -r ced99337e0e0 ipa-server/ipa-gui/ipagui/subcontrollers/delegation.py
--- a/ipa-server/ipa-gui/ipagui/subcontrollers/delegation.py	Fri Oct 19 08:34:45 2007 -0700
+++ b/ipa-server/ipa-gui/ipagui/subcontrollers/delegation.py	Fri Oct 19 08:59:40 2007 -0700
@@ -57,6 +57,8 @@ class DelegationController(IPAController
 
         tg_errors, kw = self.delegatevalidate(**kw)
         if tg_errors:
+            turbogears.flash("There were validation errors.<br/>" +
+                             "Please see the messages below for details.")
             return dict(form=delegate_form, delegate=kw,
                     tg_template='ipagui.templates.delegatenew')
 
@@ -85,7 +87,8 @@ class DelegationController(IPAController
     def edit(self, acistr, tg_errors=None):
         """Display delegate page"""
         if tg_errors:
-            turbogears.flash("There was a problem with the form!")
+            turbogears.flash("There were validation errors.<br/>" +
+                             "Please see the messages below for details.")
 
         client = self.get_ipaclient()
 
@@ -119,6 +122,8 @@ class DelegationController(IPAController
 
         tg_errors, kw = self.delegatevalidate(**kw)
         if tg_errors:
+            turbogears.flash("There were validation errors.<br/>" +
+                             "Please see the messages below for details.")
             return dict(form=delegate_form, delegate=kw,
                     tg_template='ipagui.templates.delegatenew')
 
diff -r 508a76cb4777 -r ced99337e0e0 ipa-server/ipa-gui/ipagui/subcontrollers/group.py
--- a/ipa-server/ipa-gui/ipagui/subcontrollers/group.py	Fri Oct 19 08:34:45 2007 -0700
+++ b/ipa-server/ipa-gui/ipagui/subcontrollers/group.py	Fri Oct 19 08:59:40 2007 -0700
@@ -41,7 +41,8 @@ class GroupController(IPAController):
     def new(self, tg_errors=None):
         """Displays the new group form"""
         if tg_errors:
-            turbogears.flash("There was a problem with the form!")
+            turbogears.flash("There were validation errors.<br/>" +
+                             "Please see the messages below for details.")
 
         client = self.get_ipaclient()
 
@@ -60,6 +61,8 @@ class GroupController(IPAController):
 
         tg_errors, kw = self.groupcreatevalidate(**kw)
         if tg_errors:
+            turbogears.flash("There were validation errors.<br/>" +
+                             "Please see the messages below for details.")
             return dict(form=group_new_form, group=kw,
                     tg_template='ipagui.templates.groupnew')
 
@@ -167,7 +170,8 @@ class GroupController(IPAController):
     def edit(self, cn, tg_errors=None):
         """Displays the edit group form"""
         if tg_errors:
-            turbogears.flash("There was a problem with the form!")
+            turbogears.flash("There were validation errors.<br/>" +
+                             "Please see the messages below for details.")
 
         client = self.get_ipaclient()
 
@@ -227,6 +231,8 @@ class GroupController(IPAController):
 
         tg_errors, kw = self.groupupdatevalidate(**kw)
         if tg_errors:
+            turbogears.flash("There were validation errors.<br/>" +
+                             "Please see the messages below for details.")
             return dict(form=group_edit_form, group=kw, members=member_dicts,
                         tg_template='ipagui.templates.groupedit')
 
diff -r 508a76cb4777 -r ced99337e0e0 ipa-server/ipa-gui/ipagui/subcontrollers/user.py
--- a/ipa-server/ipa-gui/ipagui/subcontrollers/user.py	Fri Oct 19 08:34:45 2007 -0700
+++ b/ipa-server/ipa-gui/ipagui/subcontrollers/user.py	Fri Oct 19 08:59:40 2007 -0700
@@ -41,7 +41,8 @@ class UserController(IPAController):
     def new(self, tg_errors=None):
         """Displays the new user form"""
         if tg_errors:
-            turbogears.flash("There was a problem with the form!")
+            turbogears.flash("There were validation errors.<br/>" +
+                             "Please see the messages below for details.")
 
         return dict(form=user_new_form, user={})
 
@@ -58,6 +59,8 @@ class UserController(IPAController):
 
         tg_errors, kw = self.usercreatevalidate(**kw)
         if tg_errors:
+            turbogears.flash("There were validation errors.<br/>" +
+                             "Please see the messages below for details.")
             return dict(form=user_new_form, user=kw,
                     tg_template='ipagui.templates.usernew')
 
@@ -196,7 +199,8 @@ class UserController(IPAController):
     def edit(self, uid, tg_errors=None):
         """Displays the edit user form"""
         if tg_errors:
-            turbogears.flash("There was a problem with the form!")
+            turbogears.flash("There were validation errors.<br/>" +
+                             "Please see the messages below for details.")
 
         client = self.get_ipaclient()
 
@@ -239,6 +243,8 @@ class UserController(IPAController):
 
         tg_errors, kw = self.userupdatevalidate(**kw)
         if tg_errors:
+            turbogears.flash("There were validation errors.<br/>" +
+                             "Please see the messages below for details.")
             return dict(form=user_edit_form, user=kw,
                         user_groups=user_groups_dicts,
                         tg_template='ipagui.templates.useredit')
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/x-pkcs7-signature
Size: 4054 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/freeipa-devel/attachments/20071019/bf92b922/attachment.bin>


More information about the Freeipa-devel mailing list