Test of create_wrmap nearly passes now.
authorphilipp <philipp@7aebc617-e5e2-0310-91dc-80fb5f6d2477>
Thu, 29 Aug 2013 12:26:06 +0000 (12:26 +0000)
committerphilipp <philipp@7aebc617-e5e2-0310-91dc-80fb5f6d2477>
Thu, 29 Aug 2013 12:26:06 +0000 (12:26 +0000)
git-svn-id: http://www.winterrodeln.org/svn/wrpylib/trunk@1532 7aebc617-e5e2-0310-91dc-80fb5f6d2477

tests/test_wrmwmarkup.py
wrpylib/wrmwmarkup.py

index 2ac1d948583c36baadcc6ef4856e62424fdfb2ce..c0990c9c01295497bfc000f8e1cfaf10c06be660 100644 (file)
@@ -169,14 +169,17 @@ def test_create_wrmap():
 
     wikitext = wrpylib.wrmwmarkup.create_wrmap(geojson)
     assert wikitext == textwrap.dedent(u'''\
 
     wikitext = wrpylib.wrmwmarkup.create_wrmap(geojson)
     assert wikitext == textwrap.dedent(u'''\
-    <wrmap lat="47.2417134" lon="11.21408895" zoom="14" width="700" height="400">
+    <wrmap height="400" lat="47.2417134" lon="11.21408895" width="700" zoom="14">
+
     <gasthaus name="Rosskogelhütte" wiki="Rosskogelhütte">47.240689 11.190454</gasthaus>
     <parkplatz>47.245789 11.238971</parkplatz>
     <haltestelle name="Oberperfuss Rangger Köpfl Lift">47.245711 11.238283</haltestelle>
     <gasthaus name="Rosskogelhütte" wiki="Rosskogelhütte">47.240689 11.190454</gasthaus>
     <parkplatz>47.245789 11.238971</parkplatz>
     <haltestelle name="Oberperfuss Rangger Köpfl Lift">47.245711 11.238283</haltestelle>
+
     <rodelbahn>
     <rodelbahn>
-        47.238587 11.203360
-        47.244951 11.230868
-        47.245470 11.237853
+    47.238587 N 11.203360 E
+    47.244951 N 11.230868 E
+    47.245470 N 11.237853 E
     </rodelbahn>
     </rodelbahn>
+
     </wrmap>''')
 
     </wrmap>''')
 
index d131402f3bee9ddd57f6bf7887294cde726099c7..b25ef636bfb38dd546cbbdd6c12be1052567a4c7 100644 (file)
@@ -535,9 +535,10 @@ def create_wrmap(geojson):
             feature_xml.text = '\n' + create_wrmap_coordinates(geo['coordinates']) + '\n'
         last_json_feature = feature_xml
         feature_xml.attrib = json_feature['properties']
             feature_xml.text = '\n' + create_wrmap_coordinates(geo['coordinates']) + '\n'
         last_json_feature = feature_xml
         feature_xml.attrib = json_feature['properties']
+        del feature_xml.attrib['type']
 
     print last_json_feature.tag
     if last_json_feature is not None:
         last_json_feature.tail = '\n\n'
 
     print last_json_feature.tag
     if last_json_feature is not None:
         last_json_feature.tail = '\n\n'
-    return xml.etree.ElementTree.tostring(wrmap_xml)
+    return xml.etree.ElementTree.tostring(wrmap_xml, encoding='utf-8')