import wrpylib.mwmarkup
import wrpylib.wrmwdb
from wrpylib.wrvalidators import LonLat, opt_lonlat_from_str, opt_lonlat_to_str, opt_uint_from_str, opt_uint_to_str, \
- opt_str_opt_comment_enum_to_str, lift_german_to_str, webauskunft_to_str, cachet_german_to_str
+ opt_str_opt_comment_enum_to_str, lift_german_to_str, webauskunft_to_str, cachet_german_to_str, \
+ opt_phone_comment_enum_to_str, lift_german_from_str
def sledrun_from_rodelbahnbox(value, sledrun):
sledrun.sled_rental_comment = opt_str_opt_comment_enum_to_str(value['Rodelverleih'])
sledrun.cachet = cachet_german_to_str(value['Gütesiegel'])
sledrun.information_web = webauskunft_to_str(value['Webauskunft'])
- sledrun.information_phone = value['Telefonauskunft']
+ sledrun.information_phone = opt_phone_comment_enum_to_str(value['Telefonauskunft'])
sledrun.image = value['Bild']
sledrun.show_in_overview = value['In Übersichtskarte']
sledrun.forum_id = value['Forumid']
def sledrun_to_rodelbahnbox(sledrun):
+ """Takes a sledrun instance that might come from the database and converts it to a OrderedDict ready
+ to be formatted as RodelbahnBox."""
value = collections.OrderedDict()
value['Position'] = LonLat(sledrun.position_longitude, sledrun.position_latitude)
value['Position oben'] = LonLat(sledrun.top_longitude, sledrun.top_latitude)
value['Aufstieg möglich'] = sledrun.walkup_possible
value['Gehzeit'] = sledrun.walkup_time
value['Aufstieg getrennt'] = sledrun.walkup_separate, sledrun.walkup_separate_comment
- value['Aufstiegshilfe'] = sledrun.lift, sledrun.lift_details
+ value['Aufstiegshilfe'] = lift_german_from_str(sledrun.lift_details)
value['Beleuchtungsanlage'] = sledrun.night_light, sledrun.night_light_comment
value['Beleuchtungstage'] = sledrun.night_light_days, sledrun.night_light_days_comment
value['Rodelverleih'] = sledrun.sled_rental, sledrun.sled_rental_comment