[node-patches] Change in ovirt-node[master]: Show infinity instead of None for bounds in valid.Number

rbarry at redhat.com rbarry at redhat.com
Tue Dec 10 16:03:46 UTC 2013


Ryan Barry has uploaded a new change for review.

Change subject: Show infinity instead of None for bounds in valid.Number
......................................................................

Show infinity instead of None for bounds in valid.Number

Previously, specifying None at either end of the bounds for a
Number validator would return a message which showed that it must
be within [0, None] instead of infinity. Show a more logical
result.

Change-Id: Ic2a2eba3e33d4354677cfa254a2a3e18c59ef813
Bug-Url: https://bugzilla.redhat.com/show_bug.cgi?id=989398
Signed-off-by: Ryan Barry <rbarry at redhat.com>
---
M src/ovirt/node/valid.py
1 file changed, 5 insertions(+), 1 deletion(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-node refs/changes/67/22267/1

diff --git a/src/ovirt/node/valid.py b/src/ovirt/node/valid.py
index 92ca35f..650eb6f 100644
--- a/src/ovirt/node/valid.py
+++ b/src/ovirt/node/valid.py
@@ -41,7 +41,7 @@
     Further below you will find an regex validator which uses regular
     expressions to validate the input.
     """
-    __exception_msg = "The field must contain {description}."
+    __exception_msg = u"The field must contain {description}."
     description = None
 
     def validate(self, value):
@@ -208,6 +208,10 @@
         super(Number, self).__init__()
         if bounds:
             self.bounds = bounds
+            vmin, vmax = self.bounds
+            vmin = u'-∞' if vmin is None else vmin
+            vmax = u'∞' if vmax is None else vmax
+            bounds = "[%s, %s]" % (vmin, vmax)
             self.description = "%s in the bounds %s" % (self.description,
                                                         bounds)
         elif exactly is not None:


-- 
To view, visit http://gerrit.ovirt.org/22267
To unsubscribe, visit http://gerrit.ovirt.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ic2a2eba3e33d4354677cfa254a2a3e18c59ef813
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-node
Gerrit-Branch: master
Gerrit-Owner: Ryan Barry <rbarry at redhat.com>



More information about the node-patches mailing list