Rewrote inn_to_gasthausbox to use the GasthausboxValidator.
authorphilipp <philipp@7aebc617-e5e2-0310-91dc-80fb5f6d2477>
Mon, 17 Mar 2014 20:15:59 +0000 (20:15 +0000)
committerphilipp <philipp@7aebc617-e5e2-0310-91dc-80fb5f6d2477>
Mon, 17 Mar 2014 20:15:59 +0000 (20:15 +0000)
git-svn-id: http://www.winterrodeln.org/svn/wrpylib/trunk@1939 7aebc617-e5e2-0310-91dc-80fb5f6d2477

wrpylib/wrmwmarkup.py

index aa2b51b76f2de498e7632233358f1dd1e61a403b..f17f255bfd872972d36377b78570b2f42aff22b6 100644 (file)
@@ -227,36 +227,7 @@ def gasthausbox_to_inn(wikitext, inn=None):
 
 def inn_to_gasthausbox(inn):
     """Converts the inn class to the {{Gasthausbox}} representation."""
-    keys = []
-    values = []
-    keys.append(u'Position')
-    values.append(wrpylib.wrvalidators.GeoNone().from_python((inn.position_latitude, inn.position_longitude)))
-    keys.append(u'Höhe')
-    values.append(wrpylib.wrvalidators.UnsignedNone().from_python(inn.position_elevation))
-    keys.append(u'Betreiber')
-    values.append(wrpylib.wrvalidators.UnicodeNone().from_python(inn.operator))
-    keys.append(u'Sitzplätze')
-    values.append(wrpylib.wrvalidators.UnsignedNone().from_python(inn.seats))
-    keys.append(u'Übernachtung')
-    values.append(wrpylib.wrvalidators.BoolUnicodeTupleValidator().from_python((inn.overnight, inn.overnight_comment)))
-    keys.append(u'Rauchfrei')
-    values.append(wrpylib.wrvalidators.GermanTristateTuple().from_python((inn.nonsmoker_area, inn.smoker_area)))
-    keys.append(u'Rodelverleih')
-    values.append(wrpylib.wrvalidators.BoolUnicodeTupleValidator().from_python((inn.sled_rental, inn.sled_rental_comment)))
-    keys.append(u'Handyempfang')
-    values.append(wrpylib.wrvalidators.ValueCommentListNeinLoopNone().from_python(inn.mobile_provider))
-    keys.append(u'Homepage')
-    values.append(wrpylib.wrvalidators.UrlNeinNone().from_python(inn.homepage))
-    keys.append(u'E-Mail')
-    values.append(wrpylib.wrvalidators.EmailCommentListNeinLoopNone(allow_masked_email=True).from_python(inn.email_list))
-    keys.append(u'Telefon')
-    values.append(wrpylib.wrvalidators.PhoneCommentListNeinLoopNone(comments_are_optional=True).from_python(inn.phone_list))
-    keys.append(u'Bild')
-    values.append(wrpylib.wrvalidators.UnicodeNone().from_python(inn.image))
-    keys.append(u'Rodelbahnen')
-    values.append(wrpylib.wrvalidators.WikiPageListLoopNone().from_python(inn.sledding_list))
-    result = [u'{{Gasthausbox']
-    return wrpylib.mwmarkup.create_template(u'Gasthausbox', [], keys, values, True)
+    return GasthausboxValidator().from_python(inn)
 
 
 def find_template_latlon_ele(wikitext, template_title):