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

scm-commit@wald.intevation.org scm-commit at wald.intevation.org
Tue Jul 6 11:21:36 CEST 2010


Author: torsten
Date: 2010-07-06 11:21:22 +0200 (Tue, 06 Jul 2010)
New Revision: 3138

Modified:
   base/trunk/mpulsweb/lib/renderer.py
Log:
* mpulsweb/lib/renderer.py (ViewRenderer._renderInt.uformat_int):
	Added helper function wich will return "unbekannt" in case of value
	"-9999999" for integer fields.


Modified: base/trunk/mpulsweb/lib/renderer.py
===================================================================
--- base/trunk/mpulsweb/lib/renderer.py	2010-07-06 07:07:08 UTC (rev 3137)
+++ base/trunk/mpulsweb/lib/renderer.py	2010-07-06 09:21:22 UTC (rev 3138)
@@ -534,13 +534,20 @@
         self.toTarget(Item("".join(out)), meta.getTarget())
 
     def _renderInt(self, node):
+
+        def uformat_int(value):
+            if value == -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=node.getValue(),
+        out.append(tag("input", name=id, id=id, 
+                       value=uformat_int(node.getValue()),
                        type="text", disabled=self.ro_mode))
         out.append('<br>')
         out.append(self._renderErrors(node))



More information about the Mpuls-commits mailing list