[rhmessaging-commits] rhmessaging commits: r2015 - mgmt/cumin/python/cumin.
rhmessaging-commits at lists.jboss.org
rhmessaging-commits at lists.jboss.org
Thu May 8 16:21:27 EDT 2008
Author: justi9
Date: 2008-05-08 16:21:27 -0400 (Thu, 08 May 2008)
New Revision: 2015
Modified:
mgmt/cumin/python/cumin/widgets.py
Log:
The UniqueNameField was failing to invoke the do_validate of its super
class.
Modified: mgmt/cumin/python/cumin/widgets.py
===================================================================
--- mgmt/cumin/python/cumin/widgets.py 2008-05-08 20:08:31 UTC (rev 2014)
+++ mgmt/cumin/python/cumin/widgets.py 2008-05-08 20:21:27 UTC (rev 2015)
@@ -545,19 +545,22 @@
self.__object = attr
def do_validate(self, session, errors):
- name = self.get(session)
+ super(UniqueNameField, self).do_validate(session, errors)
- args = {self.__field: name, }
- results = self.__class.selectBy(**args)
+ if not errors:
+ name = self.get(session)
- if self.__object:
- object = self.__object.get(session)
- if object:
- results = results.filter(self.__class.q.id != object.id)
+ args = {self.__field: name, }
+ results = self.__class.selectBy(**args)
- if results.count() > 0:
- errors.append(DuplicateValueError())
+ if self.__object:
+ object = self.__object.get(session)
+ if object:
+ results = results.filter(self.__class.q.id != object.id)
+ if results.count() > 0:
+ errors.append(DuplicateValueError())
+
class DuplicateValueError(Error):
def __init__(self, fld="name"):
super(Error, self).__init__()
More information about the rhmessaging-commits
mailing list