-# Converter functions
-# -------------------
-
-def to_title(value):
- """Line 2237 of includes/Title.php says: $this->mTextform = str_replace( '_', ' ', $dbkey );
- No not check for None because a missing title is an error"""
- return value.replace(u'_', u' ')
-
-
-# deprecated
-def to_phone_info(value):
- return model.validators.PhoneInfo(messages={'phoneInfo': u"Bitte verwenden Sie ein Format wie '0512/123456 (Schnee Alm)'."}).to_python(value)
-
-
-def conv(fnct, value, fieldname):
- "Like one of the to_xxx functions (e.g. to_bool), but adds the field name to the error message"
- try: return fnct(value)
- except formencode.Invalid, e: raise formencode.Invalid(u"Conversion error in field '%s': %s" % (fieldname, unicode_e(e)), e.value, e.state)
-
-
-def unicode_e(exception):
- """Does "unicode(exception)" as it should be. This is a workaround for bug http://bugs.python.org/issue2517
- that is not fixed in python 2.5.2.
- Details of bug: "unicode(Exception(u'\xe4'))" raises an UnicodeEncodeError exception."""
- #if exception.message: return unicode(exception.message) # this bug is already fixed. TODO: Cleanup calls to unicode_e
- return unicode(exception)
-
-
-def wikipage_to_wrsleddingcache1_2(page_id, page_title, page_text):
- """Converts a wiki page about a sledding route to a wradmin.model.WrSleddingCache1_2 class
- that can be inserted to the wradmin.model.wrsleddingcache1_2_table.
- It needs the wiki page id, the wiki page title and the page text ("old_text") as they come from the database."""
- sl = model.WrSleddingCache1_2()
- sl.page_id = page_id
- sl.page_title = to_title(page_title)
-
- # Match Rodelbahnbox
- wikitext = page_text
- regexp = re.compile(u"\{\{(Rodelbahnbox[^\}]*)\}\}", re.DOTALL)
- match = regexp.search(wikitext)
- if not match:
- raise Exception(u"No 'Rodelbahnbox' found")
- box = match.group(1)
-
- # Process Rodelbahnbox
- for property in box.split('|'):
- property = property.strip()
- if property == u'Rodelbahnbox': continue
- key_value = property.split('=')
- if len(key_value) != 2:
- raise Exception(u"Property '%s' has unexpected format" % key_value)
- key = key_value[0].strip()
- value = key_value[1].strip()
- if key == u'Rodelbahnnummer': pass
- elif key == u'Länge': sl.length = conv(model.validators.Unsigned().to_python, value, u'Länge')
- elif key == u'Gehzeit': sl.walktime = conv(model.validators.Unsigned().to_python, value, u'Gehzeit')
- elif key == u'Höhe oben': sl.height_top = conv(model.validators.Unsigned().to_python, value, u'Höhe oben')
- elif key == u'Höhe unten': sl.height_bottom = conv(model.validators.Unsigned().to_python, value, u'Höhe unten')
- elif key == u'Aufstieg getrennt': sl.walkup_separate = conv(model.validators.GermanBoolNone().to_python, value, u'Aufstieg getrennt')
- elif key == u'Lift': sl.lift = conv(model.validators.GermanBoolNone().to_python, value, u'Lift')
- elif key == u'Beleuchtung': sl.night_light = conv(model.validators.GermanBoolNone().to_python, value, u'Beleuchtung')
- elif key == u'Rodelverleih': sl.sledge_rental = conv(model.validators.GermanBoolNone().to_python, value, u'Rodelverleih')
- elif key == u'Öffentliche Anreise': sl.public_transport = conv(model.validators.GermanBoolNone().to_python, value, u'Öffentliche Anreise')
- elif key == u'Bild': sl.image = conv(model.validators.UnicodeNone().to_python, value, key)
- elif key == u'Position': (sl.position_latitude, sl.position_longitude) = conv(model.validators.GeoNone().to_python, value, u'Position') # '47.583333 N 15.75 E'
- elif key == u'Auskunft': sl.information = conv(model.validators.AustrianPhoneNumberCommentLoop().to_python, value, u'Auskunft')
- elif key == u'In Übersichtskarte': sl.show_in_overview = conv(model.validators.GermanBoolNone().to_python, value, u'In Übersichtskarte')
- elif key == u'Aufnahmedatum': sl.creation_date = conv(model.validators.DateNone().to_python, value, u'Aufnahmedatum') # '2006-03-15'
- elif key == u'Lawinengefahr':
- # sl.avalanches is not part of the 1.2 sleddingcache table. We store it in the WrSleddingCache1_2 anyway.
- sl.avalanches = conv(model.validators.GermanAvalanches().to_python, value, key)
- else: raise formencode.Invalid(u"Unbekannte Eigenschaft der Rodelbahnbox: '%s' (mit Wert '%s')" % (key, value), value, None)
- sl.under_construction = None
-
- # Match Forumlink (e.g. {{Forumlink|68}})
- match = re.search(u"\{\{Forumlink\|(\d+)\}\}", wikitext)
- if match: sl.forum_id = match.group(1)
-
- return sl
-
-
-def wikipage_to_wrsleddingcache(page_id, page_title, page_text):
- """Converts a sled-route wiki page (wradmin.model.page_table)
- to a sledding route wrsleddingcache database record (wradmin.model.wrsleddingcache_table).
- Raises a RuntimeError if the format is not OK
- sledding_wiki is a column of tabe "page".
- Returns the WrSleddingCache class"""
- sl = model.WrSleddingCache()
- sl.page_id = page_id
- sl.page_title = to_title(page_title)
- errors = [] # List of errors with localized messages
-
- # Match Rodelbahnbox
- wikitext = page_text
- regexp = re.compile(u"\{\{(Rodelbahnbox[^\}]*)\}\}", re.DOTALL)
- match = regexp.search(wikitext)
- if not match:
- raise RuntimeError(u"Rodelbahnbox nicht gefunden")
- box = match.group(1)
-
- # Process Rodelbahnbox
- for property in box.split('|'):
- property = property.strip()
- if property == u'Rodelbahnbox': continue
- equalsign_pos = property.find('=')
- if equalsign_pos < 0:
- raise RuntimeError(u"Die Eigenschaft '%s' hat ein unerwartetes Format." % property)
- key = property[:equalsign_pos].strip()
- value = property[equalsign_pos+1:].strip()
- if key in [u'Rodelbahnnummer', u'Lift']:
- errors.append("Eigenschaft '%s' wird nicht mehr unterstuetzt, siehe %s." % (key, 'http://www.winterrodeln.org/wiki/Vorlage:Rodelbahnbox'))
- elif key == u'Position': sl.position_latitude, sl.position_longitude = conv(model.validators.GeoNone().to_python, value, key) # '47.583333 N 15.75 E'
- elif key == u'Position oben': sl.top_latitude, sl.top_longitude = conv(model.validators.GeoNone().to_python, value, key) # '47.583333 N 15.75 E'
- elif key == u'Höhe oben': sl.top_elevation = conv(model.validators.UnsignedNone().to_python, value, key) # '2000'
- elif key == u'Position unten': sl.bottom_latitude, sl.bottom_longitude = conv(model.validators.GeoNone().to_python, value, key) # '47.583333 N 15.75 E'
- elif key == u'Höhe unten': sl.bottom_elevation = conv(model.validators.UnsignedNone().to_python, value, key) # '1200'
- elif key == u'Länge': sl.length = conv(model.validators.UnsignedNone().to_python, value, key) # 3500
- elif key == u'Schwierigkeit': sl.difficulty = conv(model.validators.GermanDifficulty().to_python, value, key) # 'mittel'
- elif key == u'Lawinen': sl.avalanches = conv(model.validators.GermanAvalanches().to_python, value, key) # 'kaum'
- elif key == u'Betreiber': sl.operator = conv(model.validators.UnicodeNone().to_python, value, key) # 'Max Mustermann'
- elif key == u'Öffentliche Anreise': sl.public_transport = conv(model.validators.GermanPublicTransport().to_python, value, key) # 'Mittelmäßig'
- elif key == u'Gehzeit': sl.walkup_time = conv(model.validators.UnsignedNone().to_python, value, key) # 90
- elif key == u'Aufstieg getrennt': sl.walkup_separate, sl.walkup_separate_comment = conv(model.validators.GermanTristateFloatComment().to_python, value, key) # 'Ja'
- elif key == u'Aufstiegshilfe': sl.lift, sl.lift_details = conv(model.validators.GermanLift().to_python, value, key) # 'Gondel (unterer Teil)'
- elif key == u'Beleuchtungsanlage': sl.night_light, sl.night_light_comment = conv(model.validators.GermanTristateFloatComment().to_python, value, key)
- elif key == u'Beleuchtungstage': sl.night_light_days, sl.night_light_days_comment = conv(model.validators.UnsignedCommentNone(7).to_python, value, key) # '3 (Montag, Mittwoch, Freitag)'
- elif key == u'Rodelverleih': sl.sled_rental, sl.sled_rental_comment = conv(model.validators.SledRental().to_python, value, key) # 'Talstation Serlesbahnan'
- elif key == u'Gütesiegel': sl.cachet = conv(model.validators.GermanCachet().to_python, value, key) # 'Tiroler Naturrodelbahn-Gütesiegel 2009 mittel'
- elif key == u'Webauskunft': sl.information_web = conv(model.validators.UrlNeinNone().to_python, value, key) # 'http://www.nösslachhütte.at/page9.php'
- elif key == u'Telefonauskunft': sl.information_phone = conv(model.validators.PhoneCommentListNeinLoopNone(comments_are_optional=False).to_python, value, key) # '+43-664-5487520 (Mitterer Alm)'
- elif key == u'Bild': sl.image = conv(model.validators.UnicodeNone().to_python, value, key)
- elif key == u'In Übersichtskarte': sl.show_in_overview = conv(model.validators.GermanBoolNone().to_python, value, key)
- elif key == u'Forumid': sl.forum_id = conv(model.validators.UnsignedNeinNone().to_python, value, key)
- else: raise formencode.Invalid(u"Unbekannte Eigenschaft der Rodelbahnbox: '%s' (mit Wert '%s')" % (key, value), value, None)
- sl.under_construction = None
- return sl
-
-
-def wrSleddingCache1_2_to_WrSleddingCache(wrSleddingCache1_2):
- """Converts the old WrSleddingCache format (1.2) WrSleddingCache1_2
- to the new format (1.3) WrSleddingCache."""
- wrSleddingCache = model.WrSleddingCache() # Create an object in the new format
- wrSleddingCache.page_id = wrSleddingCache1_2.page_id
- wrSleddingCache.page_title = wrSleddingCache1_2.page_id
- wrSleddingCache.position_latitude = wrSleddingCache1_2.position_latitude
- wrSleddingCache.position_longitude = wrSleddingCache1_2.position_longitude
- wrSleddingCache.top_latitude = None
- wrSleddingCache.top_longitude = None
- wrSleddingCache.top_elevation = wrSleddingCache1_2.height_top
- wrSleddingCache.bottom_latitude = None
- wrSleddingCache.bottom_longitude = None
- wrSleddingCache.bottom_elevation = wrSleddingCache1_2.height_bottom
- wrSleddingCache.length = wrSleddingCache1_2.length
- wrSleddingCache.difficulty = None
- if 'avalanches' in dir(wrSleddingCache1_2): wrSleddingCache.avalanches = wrSleddingCache1_2.avalanches
- else: wrSleddingCache.avalanches = None
- wrSleddingCache.operator = None
- if wrSleddingCache1_2.public_transport is None: wrSleddingCache.public_transport = None
- else: wrSleddingCache.public_transport = 6 if wrSleddingCache1_2.public_transport else 5
- wrSleddingCache.walkup_time = wrSleddingCache1_2.walktime
- if wrSleddingCache1_2.walkup_separate is None: wrSleddingCache.walkup_separate = None
- wrSleddingCache.walkup_separate = 1.0 if wrSleddingCache1_2.walkup_separate else 0.0
- wrSleddingCache.walkup_separate_comment = None
- wrSleddingCache.lift = wrSleddingCache1_2.lift
- if wrSleddingCache1_2.lift is None: wrSleddingCache.lift_details = None
- elif wrSleddingCache1_2.lift: wrSleddingCache.lift_details = "Sonstige"
- else: wrSleddingCache.lift_details = None
- if wrSleddingCache1_2.night_light is None: wrSleddingCache.night_light = None
- else: wrSleddingCache.night_light = 1.0 if wrSleddingCache1_2.night_light else 0.0
- wrSleddingCache.night_light_comment = None
- wrSleddingCache.night_light_days = None
- wrSleddingCache.night_light_days_comment = None
- wrSleddingCache.sled_rental = wrSleddingCache1_2.sledge_rental
- if wrSleddingCache.sled_rental: wrSleddingCache.sled_rental_comment = u'Ja'
- else: wrSleddingCache.sled_rental_comment = None
- wrSleddingCache.cachet = None
- wrSleddingCache.information_web = None
- if wrSleddingCache1_2.information is None: wrSleddingCache.information_phone = None
- else:
- m = re.match('^([-\d/\+]{5,}) \((.+)\)', wrSleddingCache1_2.information)
- if m is None: raise formencode.Invalid('PhoneInfo is invalid', value, None)
- (phone, info) = m.groups()
- # check phone
- phone = wradmin.model.validators.AustrianPhoneNumber().to_python(phone)
- # convert phone
- c = formencode.national.InternationalPhoneNumber(default_cc=lambda: 43)
- phone = c.to_python(phone)
- wrSleddingCache.information_phone = '%s (%s)' % (phone, info)
- wrSleddingCache.image = wrSleddingCache1_2.image
- wrSleddingCache.show_in_overview = wrSleddingCache1_2.show_in_overview
- wrSleddingCache.forum_id = wrSleddingCache1_2.forum_id
- wrSleddingCache.under_construction = wrSleddingCache1_2.under_construction
- return wrSleddingCache
-
-
-def wrSleddingCache_to_Rodelbahnbox(wrSleddingCache):
- """Converts the WrSleddingCache class to the {{Rodelbahnbox}} representation."""
- keys = []
- values = []
- keys.append(u'Position')
- values.append(model.validators.GeoNone().from_python((wrSleddingCache.position_latitude, wrSleddingCache.position_longitude)))
- keys.append(u'Position oben')
- values.append(model.validators.GeoNone().from_python((wrSleddingCache.top_latitude, wrSleddingCache.top_longitude)))
- keys.append(u'Höhe oben')
- values.append(model.validators.UnsignedNone().from_python(wrSleddingCache.top_elevation))
- keys.append(u'Position unten')
- values.append(model.validators.GeoNone().from_python((wrSleddingCache.bottom_latitude, wrSleddingCache.bottom_longitude)))
- keys.append(u'Höhe unten')
- values.append(model.validators.UnsignedNone().from_python(wrSleddingCache.bottom_elevation))
- keys.append(u'Länge')
- values.append(model.validators.UnsignedNone().from_python(wrSleddingCache.length))
- keys.append(u'Schwierigkeit')
- values.append(model.validators.GermanDifficulty().from_python(wrSleddingCache.difficulty))
- keys.append(u'Lawinen')
- values.append(model.validators.GermanAvalanches().from_python(wrSleddingCache.avalanches))
- keys.append(u'Betreiber')
- values.append(model.validators.UnicodeNone().from_python(wrSleddingCache.operator))
- keys.append(u'Öffentliche Anreise')
- values.append(model.validators.GermanPublicTransport().from_python(wrSleddingCache.public_transport))
- keys.append(u'Gehzeit')
- values.append(model.validators.UnsignedNone().from_python(wrSleddingCache.walkup_time))
- keys.append(u'Aufstieg getrennt')
- values.append(model.validators.GermanTristateFloatComment().from_python((wrSleddingCache.walkup_separate, wrSleddingCache.walkup_separate_comment)))
- keys.append(u'Aufstiegshilfe')
- values.append(model.validators.GermanLift().from_python((wrSleddingCache.lift, wrSleddingCache.lift_details)))
- keys.append(u'Beleuchtungsanlage')
- values.append(model.validators.GermanTristateFloatComment().from_python((wrSleddingCache.night_light, wrSleddingCache.night_light_comment)))
- keys.append(u'Beleuchtungstage')
- values.append(model.validators.UnsignedCommentNone(max=7).from_python((wrSleddingCache.night_light_days, wrSleddingCache.night_light_days_comment)))
- keys.append(u'Rodelverleih')
- values.append(model.validators.SledRental().from_python((wrSleddingCache.sled_rental, wrSleddingCache.sled_rental_comment)))
- keys.append(u'Gütesiegel')
- values.append(model.validators.GermanCachet().from_python(wrSleddingCache.cachet))
- keys.append(u'Webauskunft')
- values.append(model.validators.UrlNeinNone().from_python(wrSleddingCache.information_web))
- keys.append(u'Telefonauskunft')
- values.append(model.validators.PhoneCommentListNeinLoopNone(comments_are_optional=False).from_python(wrSleddingCache.information_phone))
- keys.append(u'Bild')
- values.append(model.validators.UnicodeNone().from_python(wrSleddingCache.image))
- keys.append(u'In Übersichtskarte')
- values.append(model.validators.GermanBoolNone().from_python(wrSleddingCache.show_in_overview))
- keys.append(u'Forumid')
- values.append(model.validators.UnsignedNeinNone().from_python(wrSleddingCache.forum_id))
- result = [u'{{Rodelbahnbox']
- for i in xrange(len(keys)): result.append(u'| %-20s = %s' % (keys[i], values[i]))
- result.append('}}')
- return '\n'.join(result)
-
-
-def wikipage_to_wrinncache1_2(page_id, page_title, page_text):
- """Converts a wiki page about an inn to an wradmin.model.WrInnCache1_2 class
- that can be inserted to the wradmin.model.wrinncache1_2_table.
- It uses only text operations and does not query or update the database.
- It needs the wiki page id, the wiki page title and the page text ("old_text") as they come from the database."""
- inn = model.WrInnCache1_2()
- inn.page_id = page_id
- inn.page_title = to_title(page_title)
-
- # Match Gasthausbox
- wikitext = page_text
- regexp = re.compile(u"\{\{(Gasthausbox[^\}]*)\}\}", re.DOTALL)
- match = regexp.search(wikitext)
- if not match:
- raise Exception(u"No 'Gasthausbox' found")
- box = match.group(1)
-
- # Process Gashausbox
- for property in box.split('|'):
- property = property.strip()
- if property == u'Gasthausbox': continue
- key_value = property.split('=')
- if len(key_value) != 2:
- raise Exception(u"Property '%s' has unexpected format" % key_value)
- key = key_value[0].strip()
- value = key_value[1].strip()
- if key == u'Gasthausnummer': pass
- elif key == u'E-Mail': inn.email = conv(formencode.validators.Email().to_python, value, u'E-Mail')
- elif key == u'Homepage': inn.homepage = conv(model.validators.UrlNeinNone().to_python, value, u'Homepage')
- elif key == u'Höhe': inn.height = conv(model.validators.Unsigned().to_python, value, u'Höhe')
- elif key == u'Bild': inn.image = conv(model.validators.UnicodeNone().to_python, value, key)
- elif key == u'Position': inn.position_latitude, inn.position_longitude = conv(model.validators.GeoNone().to_python, value, u'Position') # '47.583333 N 15.75 E'
- elif key == u'Telefon (Festnetz)': inn.phone = conv(model.validators.AustrianPhoneNumberNone().to_python, value, u'Telefon (Festnetz)')
- elif key == u'Telefon (Mobil)': inn.mobile_phone = conv(model.validators.AustrianPhoneNumberNone().to_python, value, u'Telefon (Mobil)')
- elif key == u'Rauchfrei': inn.nonsmoker_area, inn.smoker_area = conv(model.validators.GermanTristateTuple().to_python, value, u'Rauchfrei')
- elif key == u'Aufnahmedatum': inn.creation_date = conv(model.validators.DateNone().to_python, value, u'Aufnahmedatum') # '2006-03-15'
- else: raise formencode.Invalid(u"Unbekannte Eigenschaft der Gasthausbox: '%s' (mit Wert '%s')" % (key, value), value, None)
- inn.under_construction = None
- return inn
-
-
-def wikipage_to_wrinncache(page_id, page_title, page_text):
- """Converts a inn wiki page (wradmin.model.page_table) to a wrinncache database record
- (wradmin.model.wrinncache_table)."""
- inn = model.WrInnCache()
- inn.page_id = page_id
- inn.page_title = to_title(page_title)
-
- # Match Gasthausbox
- wikitext = page_text
- regexp = re.compile(u"\{\{(Gasthausbox[^\}]*)\}\}", re.DOTALL)
- match = regexp.search(wikitext)
- if not match:
- raise Exception(u"No 'Gasthausbox' found")
- box = match.group(1)
-
- # Process Gashausbox
- for property in box.split('|'):
- property = property.strip()
- if property == u'Gasthausbox': continue
- key_value = property.split('=')
- if len(key_value) != 2:
- raise Exception(u"Property '%s' has unexpected format" % key_value)
- key = key_value[0].strip()
- value = key_value[1].strip()
- if key == u'Position': inn.position_latitude, inn.position_longitude = conv(model.validators.GeoNone().to_python, value, key) # '47.583333 N 15.75 E'
- elif key == u'Höhe': inn.position_elevation = conv(model.validators.UnsignedNone().to_python, value, key)
- elif key == u'Betreiber': inn.operator = conv(model.validators.UnicodeNone().to_python, value, key)
- elif key == u'Sitzplätze': inn.seats = conv(model.validators.UnsignedNone().to_python, value, key)
- elif key == u'Übernachtung': inn.overnight, inn.overnight_comment = conv(model.validators.BoolUnicodeTupleValidator().to_python, value, key)
- elif key == u'Rauchfrei': inn.nonsmoker_area, inn.smoker_area = conv(model.validators.GermanTristateTuple().to_python, value, key)
- elif key == u'Rodelverleih': inn.sled_rental, inn.sled_rental_comment = conv(model.validators.BoolUnicodeTupleValidator().to_python, value, key)
- elif key == u'Handyempfang': inn.mobile_provider = conv(model.validators.ValueCommentListNeinLoopNone().to_python, value, key)
- elif key == u'Homepage': inn.homepage = conv(model.validators.UrlNeinNone().to_python, value, key)
- elif key == u'E-Mail': inn.email_list = conv(model.validators.EmailCommentListNeinLoopNone().to_python, value, key)
- elif key == u'Telefon': inn.phone_list = conv(model.validators.PhoneCommentListNeinLoopNone(comments_are_optional=True).to_python, value, key)
- elif key == u'Bild': inn.image = conv(model.validators.UnicodeNone().to_python, value, key)
- elif key == u'Rodelbahnen': inn.sledding_list = conv(model.validators.WikiPageListLoopNone().to_python, value, key)
- else: raise formencode.Invalid(u"Unbekannte Eigenschaft der Gasthausbox: '%s' (mit Wert '%s')" % (key, value), value, None)
- inn.under_construction = None
- return inn
-
-
-def wrInnCache1_2_to_WrInnCache(wrInnCache1_2):
- """Converts the old WrInnCache format to the new format."""
- wrInnCache = model.WrInnCache() # Create an object in the new format
- wrInnCache.page_id = wrInnCache1_2.page_id
- wrInnCache.page_title = wrInnCache1_2.page_id
- wrInnCache.position_latitude = wrInnCache1_2.position_latitude
- wrInnCache.position_longitude = wrInnCache1_2.position_longitude
- wrInnCache.position_elevation = wrInnCache1_2.height
- wrInnCache.operator = None
- wrInnCache.seats = None
- wrInnCache.overnight = None
- wrInnCache.overnight_comment = None
- wrInnCache.smoker_area = wrInnCache1_2.smoker_area
- wrInnCache.nonsmoker_area = wrInnCache1_2.nonsmoker_area
- wrInnCache.sled_rental = None
- wrInnCache.sled_rental_comment = None
- wrInnCache.mobile_provider = None
- wrInnCache.homepage = wrInnCache1_2.homepage
- wrInnCache.email_list = wrInnCache1_2.email
- phone_list = []
- c = formencode.national.InternationalPhoneNumber(default_cc=lambda: 43)
- if not wrInnCache1_2.phone is None: phone_list.append(c.to_python(wrInnCache1_2.phone))
- if not wrInnCache1_2.mobile_phone is None: phone_list.append(c.to_python(wrInnCache1_2.mobile_phone))
- if len(phone_list) >= 1: wrInnCache.phone_list = "; ".join(phone_list)
- else: phone_list = None
- wrInnCache.image = wrInnCache1_2.image
- wrInnCache.sledding_list = None
- wrInnCache.under_construction = wrInnCache1_2.under_construction
- return wrInnCache
-
-
-def wrInnCache_to_Gasthausbox(wrInnCache):
- """Converts the WrInnCache class to the {{Gasthausbox}} representation."""
- keys = []
- values = []
- keys.append(u'Position')
- values.append(model.validators.GeoNone().from_python((wrInnCache.position_latitude, wrInnCache.position_longitude)))
- keys.append(u'Höhe')
- values.append(model.validators.UnsignedNone().from_python(wrInnCache.position_elevation))
- keys.append(u'Betreiber')
- values.append(model.validators.UnicodeNone().from_python(wrInnCache.operator))
- keys.append(u'Sitzplätze')
- values.append(model.validators.UnsignedNone().from_python(wrInnCache.seats))
- keys.append(u'Übernachtung')
- values.append(model.validators.BoolUnicodeTupleValidator().from_python((wrInnCache.overnight, wrInnCache.overnight_comment)))
- keys.append(u'Rauchfrei')
- values.append(model.validators.GermanTristateTuple().from_python((wrInnCache.nonsmoker_area, wrInnCache.smoker_area)))
- keys.append(u'Rodelverleih')
- values.append(model.validators.BoolUnicodeTupleValidator().from_python((wrInnCache.sled_rental, wrInnCache.sled_rental_comment)))
- keys.append(u'Handyempfang')
- values.append(model.validators.ValueCommentListNeinLoopNone().from_python(wrInnCache.mobile_provider))
- keys.append(u'Homepage')
- values.append(model.validators.UrlNeinNone().from_python(wrInnCache.homepage))
- keys.append(u'E-Mail')
- values.append(model.validators.EmailCommentListNeinLoopNone().from_python(wrInnCache.email_list))
- keys.append(u'Telefon')
- values.append(model.validators.PhoneCommentListNeinLoopNone(comments_are_optional=True).from_python(wrInnCache.phone_list))
- keys.append(u'Bild')
- values.append(model.validators.UnicodeNone().from_python(wrInnCache.image))
- keys.append(u'Rodelbahnen')
- values.append(model.validators.WikiPageListLoopNone().from_python(wrInnCache.sledding_list))
- result = [u'{{Gasthausbox']
- for i in xrange(len(keys)): result.append(u'| %-17s = %s' % (keys[i], values[i]))
- result.append('}}\n')
- return '\n'.join(result)
-
-
-