Code

basic numeric support for NumberHTMLProperty
authorrichard <richard@57a73879-2fb5-44c3-a270-3262357dd7e2>
Sat, 15 Mar 2003 23:46:08 +0000 (23:46 +0000)
committerrichard <richard@57a73879-2fb5-44c3-a270-3262357dd7e2>
Sat, 15 Mar 2003 23:46:08 +0000 (23:46 +0000)
git-svn-id: http://svn.roundup-tracker.org/svnroot/roundup/trunk@1592 57a73879-2fb5-44c3-a270-3262357dd7e2

roundup/cgi/templating.py

index 0984bc137a2f1e6681e63b577e400e36a89f4fce..ae4f0fa3dd31003560c45abd0559c425caa78146 100644 (file)
@@ -924,6 +924,17 @@ class NumberHTMLProperty(HTMLProperty):
             value = '&quot;'.join(value.split('"'))
         return '<input name="%s" value="%s" size="%s">'%(self._formname, value, size)
 
+    def __int__(self):
+        ''' Return an int of me
+        '''
+        return int(self._value)
+
+    def __float__(self):
+        ''' Return a float of me
+        '''
+        return float(self._value)
+
+
 class BooleanHTMLProperty(HTMLProperty):
     def plain(self):
         ''' Render a "plain" representation of the property