[Mpuls-commits] r371 - in wasko/trunk: . waskaweb/converter

scm-commit@wald.intevation.org scm-commit at wald.intevation.org
Mon Mar 16 12:10:36 CET 2009


Author: teichmann
Date: 2009-03-16 12:10:33 +0100 (Mon, 16 Mar 2009)
New Revision: 371

Modified:
   wasko/trunk/ChangeLog.txt
   wasko/trunk/waskaweb/converter/wasko_v1v2.py
Log:
convert v1 nat_staat to v2 nat_staat.


Modified: wasko/trunk/ChangeLog.txt
===================================================================
--- wasko/trunk/ChangeLog.txt	2009-03-12 16:21:58 UTC (rev 370)
+++ wasko/trunk/ChangeLog.txt	2009-03-16 11:10:33 UTC (rev 371)
@@ -1,3 +1,7 @@
+2009-03-16	Sascha L. Teichmann	<teichmann at intevation.de>
+
+	* waskaweb/converter/wasko_v1v2.py: convert v1 nat_staat to v2 nat_staat.
+
 2009-03-12	Sascha L. Teichmann	<teichmann at intevation.de>
 
 	* waskaweb/model/exprtree.py: New tree based implementation

Modified: wasko/trunk/waskaweb/converter/wasko_v1v2.py
===================================================================
--- wasko/trunk/waskaweb/converter/wasko_v1v2.py	2009-03-12 16:21:58 UTC (rev 370)
+++ wasko/trunk/waskaweb/converter/wasko_v1v2.py	2009-03-16 11:10:33 UTC (rev 371)
@@ -69,12 +69,22 @@
 class WaskoV1V2(object):
 
     def __init__(self):
-        self.data = {}
+        self.data      = {}
+        self.nat_staat = None
 
     def reset(self):
         self.data.clear()
+        self.nat_staat = None
 
     def eat(self, name, attrs, value):
+
+        if name == 'nat_staat':
+            self.nat_staat = value
+            return True
+
+        if name == 'nat_staat_t': # do not import
+            return True
+
         if name in OLD_ITEMS:
             value = decode_int(value)
             if not value is None:
@@ -83,6 +93,16 @@
         return False
 
     def finish(self, master_loader):
+
+        if not self.nat_staat is None:
+            nat_staat = decode_int(self.nat_staat)
+            if master_loader.version < 2:
+                if nat_staat == '29': # deutsch
+                    nat_staat = 1
+                elif nat_staat != -1 or nat_staat != -3:
+                    nat_staat = 2 # andere
+            master_loader.data.append(('nat_staat', nat_staat))
+
         if self.data:
             for key, values in ADDS:
                 s = reduce(add, map(lambda v: self.data.get(v), values), None)



More information about the Mpuls-commits mailing list