[Mpuls-commits] r3222 - base/trunk/mpulsweb/lib

scm-commit@wald.intevation.org scm-commit at wald.intevation.org
Wed Jul 21 15:43:06 CEST 2010


Author: torsten
Date: 2010-07-21 15:43:05 +0200 (Wed, 21 Jul 2010)
New Revision: 3222

Modified:
   base/trunk/mpulsweb/lib/renderer.py
Log:
* mpulsweb/lib/renderer.py (ViewRenderer._renderNumeric): Added new render function for numeric fields. 


Modified: base/trunk/mpulsweb/lib/renderer.py
===================================================================
--- base/trunk/mpulsweb/lib/renderer.py	2010-07-21 10:08:40 UTC (rev 3221)
+++ base/trunk/mpulsweb/lib/renderer.py	2010-07-21 13:43:05 UTC (rev 3222)
@@ -561,6 +561,26 @@
         out.append(self._renderErrors(node))
         self.toTarget(Item("".join(out)), meta.getTarget())
 
+    def _renderNumeric(self, node):
+
+        def uformat_numeric(value):
+            if value == float(-9999999):
+                return "unbekannt"
+            return value
+
+        meta = self._getMeta(node)
+        out = []
+        id = node.getIdentifier()
+        out.append(self._renderLabel(node))
+        out.append(self._renderAttributes(node))
+        out.append('<br>')
+        out.append(tag("input", name=id, id=id,
+                       value=uformat_numeric(node.getValue()),
+                       type="text", disabled=self.ro_mode))
+        out.append('<br>')
+        out.append(self._renderErrors(node))
+        self.toTarget(Item("".join(out)), meta.getTarget())
+
     def _renderTextArea(self, node):
         meta = self._getMeta(node)
         out = []
@@ -830,6 +850,8 @@
             self._renderTextArea(child)
         elif isinstance(meta, data.IntLeaf):
             self._renderInt(child)
+        elif isinstance(meta, data.NumericLeaf):
+            self._renderNumeric(child)
         elif isinstance(meta, data.DateLeaf):
             self._renderDate(child)
         elif isinstance(meta, data.ExternalChoiceListLeaf):



More information about the Mpuls-commits mailing list