Fixed conversion errors in sledrun_to_rodelbahnbox.
authorphilipp <philipp@7aebc617-e5e2-0310-91dc-80fb5f6d2477>
Sun, 29 Jan 2017 22:18:57 +0000 (22:18 +0000)
committerphilipp <philipp@7aebc617-e5e2-0310-91dc-80fb5f6d2477>
Sun, 29 Jan 2017 22:18:57 +0000 (22:18 +0000)
git-svn-id: http://www.winterrodeln.org/svn/wrpylib/trunk@2626 7aebc617-e5e2-0310-91dc-80fb5f6d2477

wrpylib/wrmwmarkup.py

index f705fecbc7b39a845979709da446d6d458f68959..66969af09cc6c954c5bec6f6b7a430a48e1ef3fc 100644 (file)
@@ -87,17 +87,17 @@ def inn_from_gasthausbox(value, inn):
     # page_id = None # this field is not updated because it is not present in the Gasthausbox
     # page_title = None # this field is not updated because it is not present in the Gasthausbox
     def convtodb(value, key):
-        v = value[key]
-        if v is not None:
-            v = GASTHAUSBOX_DICT[key].to_str(v)
+        v = GASTHAUSBOX_DICT[key].to_str(value[key])
+        if v == '':
+            return None
         return v
     inn.position_longitude, inn.position_latitude = value['Position']
     inn.position_elevation = value['Höhe']
     inn.operator = value['Betreiber']
     inn.seats = value['Sitzplätze']
     inn.overnight, inn.overnight_comment = value['Übernachtung']
-    inn.smoker_area = value['Rauchfrei'] < 0.9
-    inn.nonsmoker_area = value['Rauchfrei'] > 0.1
+    inn.smoker_area = None if value['Rauchfrei'] is None else value['Rauchfrei'] < 0.9
+    inn.nonsmoker_area = None if value['Rauchfrei'] is None else value['Rauchfrei'] > 0.1
     inn.sled_rental, inn.sled_rental_comment = value['Rodelverleih']
     inn.mobile_provider = convtodb(value, 'Handyempfang')
     inn.homepage = convtodb(value, 'Homepage')