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

This commit is contained in:
Kevin McCarthy 2007-10-19 08:59:40 -07:00
parent 4427ff78f6
commit fd8690dd63
3 changed files with 22 additions and 5 deletions

View File

@ -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')

View File

@ -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')

View File

@ -38,7 +38,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={})
@ -55,6 +56,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')
@ -193,7 +196,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()
@ -236,6 +240,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')