Worked on inn_to_gasthausbox - the test passes now.
authorphilipp <philipp@7aebc617-e5e2-0310-91dc-80fb5f6d2477>
Fri, 27 Jan 2017 22:04:02 +0000 (22:04 +0000)
committerphilipp <philipp@7aebc617-e5e2-0310-91dc-80fb5f6d2477>
Fri, 27 Jan 2017 22:04:02 +0000 (22:04 +0000)
git-svn-id: http://www.winterrodeln.org/svn/wrpylib/trunk@2608 7aebc617-e5e2-0310-91dc-80fb5f6d2477

wrpylib/wrmwmarkup.py

index b2198791e8f4c6866859345fe7bf4226e7283529..f0919de3975717023bc02fdb5698b1ce230a656b 100644 (file)
@@ -111,6 +111,10 @@ def inn_from_gasthausbox(value, inn):
 
 def inn_to_gasthausbox(inn):
     """Converts an inn class to a dict of Gasthausbox properties. value is an Inn instance."""
 
 def inn_to_gasthausbox(inn):
     """Converts an inn class to a dict of Gasthausbox properties. value is an Inn instance."""
+    def convfromdb(value, key):
+        if value is None:
+            return None
+        return GASTHAUSBOX_DICT[key].from_str(value)
     value = collections.OrderedDict()
     value['Position'] = LonLat(inn.position_longitude, inn.position_latitude)
     value['Höhe'] = inn.position_elevation
     value = collections.OrderedDict()
     value['Position'] = LonLat(inn.position_longitude, inn.position_latitude)
     value['Höhe'] = inn.position_elevation
@@ -119,12 +123,12 @@ def inn_to_gasthausbox(inn):
     value['Übernachtung'] = (inn.overnight, inn.overnight_comment)
     value['Rauchfrei'] = {(False, True): 0.0, (True, True): 0.5, (True, False): 1.0}.get((inn.nonsmoker_area, inn.smoker_area), None)
     value['Rodelverleih'] = (inn.sled_rental, inn.sled_rental_comment)
     value['Übernachtung'] = (inn.overnight, inn.overnight_comment)
     value['Rauchfrei'] = {(False, True): 0.0, (True, True): 0.5, (True, False): 1.0}.get((inn.nonsmoker_area, inn.smoker_area), None)
     value['Rodelverleih'] = (inn.sled_rental, inn.sled_rental_comment)
-    value['Handyempfang'] = inn.mobile_provider
-    value['Homepage'] = inn.homepage
-    value['E-Mail'] = inn.email_list
-    value['Telefon'] = inn.phone_list
+    value['Handyempfang'] = convfromdb(inn.mobile_provider, 'Handyempfang')
+    value['Homepage'] = convfromdb(inn.homepage, 'Homepage')
+    value['E-Mail'] = convfromdb(inn.email_list, 'E-Mail')
+    value['Telefon'] = convfromdb(inn.phone_list, 'Telefon')
     value['Bild'] = inn.image
     value['Bild'] = inn.image
-    value['Rodelbahnen'] = inn.sledding_list
+    value['Rodelbahnen'] = convfromdb(inn.sledding_list, 'Rodelbahnen')
     return value
 
 
     return value