Author: tmckay
Date: 2011-06-02 14:00:58 +0000 (Thu, 02 Jun 2011)
New Revision: 4799
Modified:
trunk/cumin/python/cumin/grid/limit.py
Log:
Add an error message on negative limit value, in addition to code that
replaces negative limits with 0 on send.
(BZ696697 modification)
Modified: trunk/cumin/python/cumin/grid/limit.py
===================================================================
--- trunk/cumin/python/cumin/grid/limit.py 2011-06-02 13:47:16 UTC (rev 4798)
+++ trunk/cumin/python/cumin/grid/limit.py 2011-06-02 14:00:58 UTC (rev 4799)
@@ -265,14 +265,20 @@
def validate(self, session):
value = self.input.get(session)
+ message = None
if value:
try:
if value.lower() not in ("unlimited", "na",
"n/a"):
value = float(value)
+ if value < 0:
+ message = "The '%s' field may not be less than
zero" \
+ % self.render_title(session)
except:
- title = self.render_title(session)
- message = "The '%s' field must be either
\"unlimited\", an integer or a float" % title
- self.form.errors.add(session, FormError(message))
+ message = "The '%s' field must be either
\"unlimited\", " \
+ "an integer or a float" % self.render_title(session)
+
+ if message:
+ self.form.errors.add(session, FormError(message))
Show replies by date