From: philipp Date: Sun, 30 May 2010 15:20:21 +0000 (+0000) Subject: The last commit happened accidently. Undid commit r563 below wradmin with the followi... X-Git-Url: https://git.toastfreeware.priv.at/philipp/winterrodeln/wradmin.git/commitdiff_plain/7a285626986c1f9d6dff81d49f79c6b490288733 The last commit happened accidently. Undid commit r563 below wradmin with the following command: philipp@sirius:~/projekte/winterrodeln/mediawiki/wradmin$ svn merge -c -563 http://www.winterrodeln.org/svn/servermediawiki/trunk/wradmin . git-svn-id: http://www.winterrodeln.org/svn/servermediawiki/trunk/wradmin@566 7aebc617-e5e2-0310-91dc-80fb5f6d2477 --- diff --git a/wradmin/setup.py b/wradmin/setup.py index 06bdc36..58f8be2 100644 --- a/wradmin/setup.py +++ b/wradmin/setup.py @@ -19,7 +19,7 @@ setup( "AuthKit>=0.4.3,<=0.4.99", "SQLAlchemy>=0.5", "lxml>=2.2", - # "matplotlib>=0.9", + "matplotlib>=0.9", "Babel>=0.9" ], setup_requires=["PasteScript>=1.6.3"], diff --git a/wradmin/wradmin/controllers/rodelbahn.py b/wradmin/wradmin/controllers/rodelbahn.py index 237e6e4..7c3b806 100644 --- a/wradmin/wradmin/controllers/rodelbahn.py +++ b/wradmin/wradmin/controllers/rodelbahn.py @@ -20,7 +20,6 @@ class RodelbahnController(BaseController): def index(self): return render('index.html') - def list(self): "Lists all sledding routes" q = model.meta.Session.query(model.WrSleddingCache) @@ -42,9 +41,6 @@ class RodelbahnController(BaseController): def _wikipage_to_wrsleddingcache(self, sledding_wiki): "Converts a sledding route wiki page to a sledding route wrsleddingcache database record." - # TODO: Use mediawiki.wikipage_to_wrsleddingcache - - sl = model.WrSleddingCache() sl.page_id = sledding_wiki.page_id sl.page_title = to_title(sledding_wiki.page_title) diff --git a/wradmin/wradmin/lib/mediawiki.py b/wradmin/wradmin/lib/mediawiki.py index ea05d27..378dd80 100644 --- a/wradmin/wradmin/lib/mediawiki.py +++ b/wradmin/wradmin/lib/mediawiki.py @@ -1,18 +1,14 @@ -#!/usr/bin/python2.5 -# -*- coding: iso-8859-15 -*- -# $Id$ "MediaWiki communication functions" -import datetime -import re from authkit.users import UsersReadOnly, md5 +import datetime +import wradmin.model as model +import wradmin.model.validators import formencode, formencode.national + import logging log = logging.getLogger(__name__) -import wradmin.model as model -import wradmin.model.validators - # Converter functions # ------------------- @@ -67,22 +63,10 @@ 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 to_valuecommentlist(value): - """A value-comment list looks like one of the following lines: - value - value (optional comment) - value1; value2 - value1; value2 (optional comment) - value1 (optional comment1); value2 (optional comment2); value3 (otional comment3) - value1 (optional comment1); value2 (optional comment2); value3 (otional comment3) - This function returns the value-comment list as list of tuples. If no comment is present, None is specified.""" - return model.validators.ValueCommentList().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) + 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): @@ -93,185 +77,6 @@ def unicode_e(exception): return unicode(exception) -def wikipage_to_wrsleddingcache1_2(wiki_page): - """Converts a sledding route wiki page (wradmin.model.page_table) - to a sledding route wrsleddingcache database record (version 1.2) (wradmin.model.wrsleddingcache1_2_table).""" - sl = model.WrSleddingCache1_2() - sl.page_id = wiki_page.page_id - sl.page_title = to_title(wiki_page.page_title) - - # Match Rodelbahnbox - wikitext = wiki_page.old_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(to_unsigned, value, u'Länge') - elif key == u'Gehzeit': sl.walktime = conv(to_unsigned, value, u'Gehzeit') - elif key == u'Höhe oben': sl.height_top = conv(to_unsigned, value, u'Höhe oben') - elif key == u'Höhe unten': sl.height_bottom = conv(to_unsigned, value, u'Höhe unten') - elif key == u'Aufstieg getrennt': sl.walkup_separate = conv(to_bool, value, u'Aufstieg getrennt') - elif key == u'Lift': sl.lift = conv(to_bool, value, u'Lift') - elif key == u'Beleuchtung': sl.night_light = conv(to_bool, value, u'Beleuchtung') - elif key == u'Rodelverleih': sl.sledge_rental = conv(to_bool, value, u'Rodelverleih') - elif key == u'Öffentliche Anreise': sl.public_transport = conv(to_bool, value, u'Öffentliche Anreise') - elif key == u'Bild': sl.image = value - elif key == u'Position': (sl.position_latitude, sl.position_longitude) = conv(to_geo, value, u'Position') # '47.583333 N 15.75 E' - elif key == u'Auskunft': sl.information = conv(to_phone_info, value, u'Auskunft') - elif key == u'In Übersichtskarte': sl.show_in_overview = conv(to_bool, value, u'In Übersichtskarte') - elif key == u'Aufnahmedatum': sl.creation_date = conv(to_date, value, u'Aufnahmedatum') # '2006-03-15' - elif key == u'Lawinengefahr': - if not value in [u'kaum', u'selten', u'gelegentlich', u'häufig']: raise formencode.Invalid(u"No valid value for 'Lawinengefahr': '%s'" % value, value, None) - 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(wiki_page): - """Converts a sledding 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 = wiki_page.page_id - sl.page_title = to_title(wiki_page.page_title) - errors = [] # List of errors with localized messages - - # Match Rodelbahnbox - wikitext = wiki_page.old_text - regexp = re.compile(u"\{\{(Rodelbahnbox[^\}]*)\}\}", re.DOTALL) - match = regexp.search(wikitext) - if not match: - raise RuntimeError(_(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 RuntimeError(_(u"Property '%s' has unexpected format") % key_value) - key = key_value[0].strip() - value = key_value[1].strip() - if key in [u'Rodelbahnnummer', u'Lift']: - errors.append(_("Property '%s' is not supported anymore, see %s.") % (key, 'http://www.winterrodeln.org/wiki/Vorlage:Rodelbahnbox')) - elif key == u'Position': (sl.position_latitude, sl.position_longitude) = conv(to_geo, value, u'Position') # '47.583333 N 15.75 E' - elif key == u'Position oben': (sl.top_latitude, sl.top_longitude) = conv(to_geo, value, u'Position oben') # '47.583333 N 15.75 E' - - -| Höhe oben = 1700 -| Position unten = -| Höhe unten = 1200 -| Länge = 3500 -| Schwierigkeit = mittel -| Lawinen = kaum -| Betreiber = Max Mustermann -| Öffentliche Anreise = Mittelmäßig -| Gehzeit = 90 -| Aufstieg getrennt = Ja -| Aufstiegshilfe = Gondel (unterer Teil) -| Beleuchtungsanlage = Ja -| Beleuchtungstage = 3 (Montag, Mittwoch, Freitag) -| Rodelverleih = Ja (Talstation Serlesbahnan) -| Gütesiegel = Tiroler Naturrodelbahn-Gütesiegel 2009 mittel -| Webauskunft = http://www.nösslachhütte.at/page9.php -| Telefonauskunft = +43-664-5487520 (Mitterer Alm) -| Bild = Rodelbahn_Mitterer_Alm_04.jpg -| In Übersichtskarte = Ja -| Forumid = 33 - - sa.Column("top_elevation", types.Integer), - sa.Column("bottom_latitude", types.Float), - sa.Column("bottom_longitude", types.Float), - sa.Column("bottom_elevation", types.Integer), - sa.Column("length", types.Integer), - sa.Column("difficulty", types.Integer), - sa.Column("avalanches", types.Integer), - sa.Column("operator", types.Unicode(255)), - sa.Column("public_transport", types.Integer), - sa.Column("walkup_time", types.Integer), - sa.Column("walkup_separate", types.Float), - sa.Column("walkup_separate_comment", types.Unicode(255)), - sa.Column("lift", types.Boolean), - sa.Column("lift_details", types.Unicode(255)), - sa.Column("night_light", types.Float), - sa.Column("night_light_days", types.Integer), - sa.Column("night_light_days_comment", types.Unicode(255)), - sa.Column("sled_rental", types.Boolean), - sa.Column("cachet", types.Unicode(255)), - sa.Column("information_web", types.Unicode(255)), - sa.Column("information_phone", types.Unicode(255)), - sa.Column("image", types.Unicode(255)), - sa.Column("show_in_overview", types.Boolean), - sa.Column("forum_id", types.Integer), - sa.Column("under_construction", types.Boolean), - ) - - - - - - - - elif key == u'Bild': sl.image = value - - elif key == u'Länge': sl.length = conv(to_unsigned, value, u'Länge') - elif key == u'Gehzeit': sl.walktime = conv(to_unsigned, value, u'Gehzeit') - elif key == u'Höhe oben': sl.height_top = conv(to_unsigned, value, u'Höhe oben') - elif key == u'Höhe unten': sl.height_bottom = conv(to_unsigned, value, u'Höhe unten') - elif key == u'Aufstieg getrennt': - tristate = conv(to_tristate, value, u'Aufstieg getrennt') - if tristate == (True, False): sl.walkup_separate = 1.0 - elif tristate == (True, True): sl.walkup_separate = 0.5 - elif tristate == (False, True): sl.walkup_separate = 0.0 - elif key == u'Aufstiegshilfe': - valuecommentlist = conv(to_valuecommentlist, value, u'Aufstiegshilfe') - lift = len(valuecommentlist) > 0 - for value, comment in valuecommentlist: - if value == u'Nein': - if len(valuecommentlist) != 1: raise formencode.Invalid('"Nein" kann mit keiner anderen Aufstiegshilfe kombiniert werden.', value, None) - lift = False - elif not value in [u'Sessellift', u'Gondel', u'Linienbus', u'Taxi', u'Sonstige']: - raise formencode.Invalid(u'"%s" ist keine gültige Aufstiegshilfe.' % value, value, None) - sl.lift = lift - sl.lift_detail = model.validators.ValueCommentList().from_python(valuecommentlist) - elif key == u'Beleuchtung': sl.night_light = conv(to_bool, value, u'Beleuchtung') - elif key == u'Rodelverleih': sl.sledge_rental = conv(to_bool, value, u'Rodelverleih') - elif key == u'Öffentliche Anreise': sl.public_transport = conv(to_bool, value, u'Öffentliche Anreise') - elif key == u'Auskunft': sl.information = conv(to_phone_info, value, u'Auskunft') - elif key == u'In Übersichtskarte': sl.show_in_overview = conv(to_bool, value, u'In Übersichtskarte') - elif key == u'Aufnahmedatum': sl.creation_date = conv(to_date, value, u'Aufnahmedatum') # '2006-03-15' - elif key == u'Lawinengefahr': - if not value in [u'kaum', u'selten', u'gelegentlich', u'häufig']: raise formencode.Invalid(u"No valid value for 'Lawinengefahr': '%s'" % value, value, None) - 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 - - # User management # --------------- diff --git a/wradmin/wradmin/model/__init__.py b/wradmin/wradmin/model/__init__.py index c5d29b1..f1839b0 100644 --- a/wradmin/wradmin/model/__init__.py +++ b/wradmin/wradmin/model/__init__.py @@ -10,9 +10,6 @@ def init_model(engine): meta.engine = engine -# Current table definition -# - version 1.2 -# - version 1.3 (no changes) wrreport_table = sa.Table("wrreport", meta.metadata, sa.Column("id", types.Integer, primary_key=True), sa.Column("page_id", types.Integer, schema.ForeignKey('wrsleddingcache.page_id')), @@ -35,9 +32,7 @@ wrreport_table = sa.Table("wrreport", meta.metadata, ) -# Old table definition -# - version 1.2 -wrsleddingcache1_2_table = sa.Table("wrsleddingcache1_2", meta.metadata, +wrsleddingcache_table = sa.Table("wrsleddingcache", meta.metadata, sa.Column("page_id", types.Integer, primary_key=True), sa.Column("page_title", types.Unicode(255)), sa.Column("length", types.Integer), @@ -59,64 +54,6 @@ wrsleddingcache1_2_table = sa.Table("wrsleddingcache1_2", meta.metadata, ) -# Current table definition -# - version 1.3 (changes made from version 1.2) -wrsleddingcache_table = sa.Table("wrsleddingcache", meta.metadata, - sa.Column("page_id", types.Integer, primary_key=True), - sa.Column("page_title", types.Unicode(255)), - sa.Column("position_latitude", types.Float), - sa.Column("position_longitude", types.Float), - sa.Column("top_latitude", types.Float), - sa.Column("top_longitude", types.Float), - sa.Column("top_elevation", types.Integer), - sa.Column("bottom_latitude", types.Float), - sa.Column("bottom_longitude", types.Float), - sa.Column("bottom_elevation", types.Integer), - sa.Column("length", types.Integer), - sa.Column("difficulty", types.Integer), - sa.Column("avalanches", types.Integer), - sa.Column("operator", types.Unicode(255)), - sa.Column("public_transport", types.Integer), - sa.Column("walkup_time", types.Integer), - sa.Column("walkup_separate", types.Float), - sa.Column("walkup_separate_comment", types.Unicode(255)), - sa.Column("lift", types.Boolean), - sa.Column("lift_details", types.Unicode(255)), - sa.Column("night_light", types.Float), - sa.Column("night_light_days", types.Integer), - sa.Column("night_light_days_comment", types.Unicode(255)), - sa.Column("sled_rental", types.Boolean), - sa.Column("cachet", types.Unicode(255)), - sa.Column("information_web", types.Unicode(255)), - sa.Column("information_phone", types.Unicode(255)), - sa.Column("image", types.Unicode(255)), - sa.Column("show_in_overview", types.Boolean), - sa.Column("forum_id", types.Integer), - sa.Column("under_construction", types.Boolean), - ) - - -# Old table definition -# - version 1.2 -wrinncache_table1_2 = sa.Table("wrinncache1_2", meta.metadata, - sa.Column("page_id", types.Integer, primary_key=True), - sa.Column("page_title", types.Unicode(255)), - sa.Column("height", types.Integer), - sa.Column("phone", types.Unicode(30)), - sa.Column("mobile_phone", types.Unicode(30)), - sa.Column("email", types.Unicode(255)), - sa.Column("homepage", types.Unicode(255)), - sa.Column("smoker_area", types.Boolean), - sa.Column("nonsmoker_area", types.Boolean), - sa.Column("image", types.Unicode(255)), - sa.Column("position_latitude", types.Float), - sa.Column("position_longitude", types.Float), - sa.Column("under_construction", types.Boolean), - ) - - -# Current table definition -# - version 1.3 (changes made from version 1.2) wrinncache_table = sa.Table("wrinncache", meta.metadata, sa.Column("page_id", types.Integer, primary_key=True), sa.Column("page_title", types.Unicode(255)), @@ -183,29 +120,14 @@ class WrReport(object): pass -# Old version (not mapped) -class WrSleddingCache1_2(object): - pass - - class WrSleddingCache(object): pass -# Old version (not mapped) -class WrInnCache1_2(object): - pass - - class WrInnCache(object): pass -# Page (not mapped) -class Page(object): - pass - - orm.mapper(WrReport, wrreport_table) # We could add a relation but we don't need it yet: # orm.mapper(WrSleddingCache, wrsleddingcache_table, properties = {'reports': orm.relation(WrReport, backref='sledding')}) diff --git a/wradmin/wradmin/model/validators.py b/wradmin/wradmin/model/validators.py index c1e4940..9f555e8 100644 --- a/wradmin/wradmin/model/validators.py +++ b/wradmin/wradmin/model/validators.py @@ -266,38 +266,3 @@ class PhoneInfo(formencode.FancyValidator): phone = AustrianPhoneNumber().to_python(phone) return "%s (%s)" % (phone, info) - - -class ValueCommentList(formencode.FancyValidator): - """A value-comment list looks like one of the following lines: - value - value (optional comment) - value1; value2 - value1; value2 (optional comment) - value1 (optional comment1); value2 (optional comment2); value3 (otional comment3) - value1 (optional comment1); value2 (optional comment2); value3 (otional comment3) - This function returns the value-comment list as list of tuples: - [(u'value1', u'comment1'), (u'value2', None)] - If no comment is present, None is specified.""" - messages = {'infoFormat': "'%%(value)s' is no valid format, please use a form like 'value1 (optional comment1); value2 (optional comment2)'"} - - def _to_python(self, value, state): - self.assert_string(value, state) - value_options = [s.strip() for s in value.split(';')] - result = [] - for value_option in value_options: - left = value_option.find('(') - right = value_option.rfind(')') - if left < 0 and right < 0: - result.append((value_option, None)) - elif left >= 0 and right >= 0 and left < right: - result.append((value_option[:left].strip(), value_option[left+1:right].strip())) - else: raise formencode.Invalid(self.message('infoFormat', state) % {'value': value}, value, state) - return result - - def _from_python(self, value, state): - result = [] - for v, c in value: - if c is None: result.append(v) - else: result.append('%s (%s)' % (v, c)) - return "; ".join(result) diff --git a/wradmin/wradmin/templates/rodelbahn_list.html b/wradmin/wradmin/templates/rodelbahn_list.html index eb77fe8..b9ffe04 100644 --- a/wradmin/wradmin/templates/rodelbahn_list.html +++ b/wradmin/wradmin/templates/rodelbahn_list.html @@ -50,7 +50,7 @@ ${h.bool(s.walkup_separate)} ${h.bool(s.lift)} ${h.bool(s.night_light)} - ${h.bool(s.sled_rental)} + ${h.bool(s.sledge_rental)} ${h.bool(s.public_transport)} ${s.image} ${s.position_latitude} diff --git a/wradmin/wradmin/templates/rodelbahn_view.html b/wradmin/wradmin/templates/rodelbahn_view.html index 52d7da4..10fa685 100644 --- a/wradmin/wradmin/templates/rodelbahn_view.html +++ b/wradmin/wradmin/templates/rodelbahn_view.html @@ -53,7 +53,7 @@ Rodelverleih - ${h.bool(c.sledding.sled_rental)} + ${h.bool(c.sledding.sledge_rental)} Öffentliche Anreise diff --git a/wradmin/wradmin/templates/wrgpxtool.html b/wradmin/wradmin/templates/wrgpxtool.html index 05147b0..dc1992f 100644 --- a/wradmin/wradmin/templates/wrgpxtool.html +++ b/wradmin/wradmin/templates/wrgpxtool.html @@ -14,7 +14,7 @@

WRGPX-Werkzeug

-

Achtung: Da das WRGPX Format noch in Arbeit ist, ist diese Seite natürlich auch noch nicht fertig!

+

Achtung: Da das WRGPX Format noch in Arbeit ist, ist diese Seite natürlich auch noch nicht fertig!

WRGPX steht für "Winterrodeln GPX". Hier können Sie eine .gpx Datei auf ihre Gültigkeit untersuchen.

diff --git a/wradmin/wradmin/tests/test_lib.py b/wradmin/wradmin/tests/test_lib.py index df55e02..c764688 100644 --- a/wradmin/wradmin/tests/test_lib.py +++ b/wradmin/wradmin/tests/test_lib.py @@ -1,117 +1,4 @@ -#!/usr/bin/python2.5 -# -*- coding: iso-8859-15 -*- -# $Id$ import wradmin.lib -import wradmin.model - - -def test_wikipage_to_wrsleddingcache1_2(): - wiki_page = wradmin.model.Page() - wiki_page.page_id = 7 - wiki_page.page_title = u"Kemater Alm" - wiki_page.old_text = u""" -Text above -{{Rodelbahnbox -| Bild = Rodelbahn_Mitterer_Alm_04.jpg -| Position = 47.203959 N 11.308052 E -| Länge = 3500 -| Gehzeit = 90 -| Höhe oben = 2000 -| Höhe unten = 1200 -| Aufstieg getrennt = Ja -| Lift = Nein -| Beleuchtung = Nein -| Rodelverleih = Ja -| Öffentliche Anreise = Nein -| Lawinengefahr = kaum -| Auskunft = 0664/5487520 (Mitterer Alm) -| In Übersichtskarte = Ja -}} -Text below""" - sledding_cache = wradmin.lib.mediawiki.wikipage_to_wrsleddingcache1_2(wiki_page) - assert sledding_cache.page_id == 7 - assert sledding_cache.page_title == u"Kemater Alm" - assert sledding_cache.length == 3500 - assert sledding_cache.walktime == 90 - assert sledding_cache.height_top == 2000 - assert sledding_cache.height_bottom == 1200 - assert sledding_cache.walkup_separate == True - assert sledding_cache.lift == False - assert sledding_cache.night_light == False - assert sledding_cache.sledge_rental == True - assert sledding_cache.public_transport == False - assert sledding_cache.image == u"Rodelbahn_Mitterer_Alm_04.jpg" - assert sledding_cache.position_latitude == 47.203959 - assert sledding_cache.position_longitude == 11.308052 - assert sledding_cache.information == u"+43/664/5487520 (Mitterer Alm)" - # assert sledding_cache.forum_id - # assert sledding_cache.under_construction - assert sledding_cache.show_in_overview == True - - -def test_wikipage_to_wrsleddingcache(): - wiki_page = wradmin.model.Page() - wiki_page.page_id = 7 - wiki_page.page_title = u"Kemater Alm" - wiki_page.old_text = u""" -Text above -{{Rodelbahnbox -| Position = 47.203959 N 11.308052 E -| Position oben = -| Höhe oben = 1700 -| Position unten = -| Höhe unten = 1200 -| Länge = 3500 -| Schwierigkeit = mittel -| Lawinen = kaum -| Betreiber = Max Mustermann -| Öffentliche Anreise = Mittelmäßig -| Gehzeit = 90 -| Aufstieg getrennt = Ja -| Aufstiegshilfe = Gondel (unterer Teil) -| Beleuchtungsanlage = Ja -| Beleuchtungstage = 3 (Montag, Mittwoch, Freitag) -| Rodelverleih = Ja (Talstation Serlesbahnan) -| Gütesiegel = Tiroler Naturrodelbahn-Gütesiegel 2009 mittel -| Webauskunft = http://www.nösslachhütte.at/page9.php -| Telefonauskunft = +43-664-5487520 (Mitterer Alm) -| Bild = Rodelbahn_Mitterer_Alm_04.jpg -| In Übersichtskarte = Ja -| Forumid = 33 -}} -Text below""" - sledding_cache = wradmin.lib.mediawiki.wikipage_to_wrsleddingcache(wiki_page) - assert sledding_cache.page_id == 7 - assert sledding_cache.page_title == u"Kemater Alm" - - assert sledding_cache.position_latitude == 47.203959 - assert sledding_cache.position_longitude == 11.308052 - assert sledding_cache.top_latitude == 47.203959 - assert sledding_cache.top_longitude == 11.308052 - assert sledding_cache.top_elevation == 2000 - assert sledding_cache.bottom_latitude == 47.203959 - assert sledding_cache.bottom_longitude == 11.308052 - assert sledding_cache.bottom_elevation == 1200 - - assert sledding_cache.length == 3500 - assert sledding_cache.walktime == 90 - assert sledding_cache.walkup_separate == 1.0 - sa.Column("walkup_separate_comment", types.Unicode(255)), - assert sledding_cache.lift == False - sa.Column("lift_details", types.Unicode(255)), - assert sledding_cache.night_light == 1.0 - sa.Column("night_light_days", types.Integer), - sa.Column("night_light_days_comment", types.Unicode(255)), - assert sledding_cache.sled_rental == True - assert sledding_cache.public_transport == 3 - assert sledding_cache.avalanche = 1 - assert sledding_cache.image == u"Rodelbahn_Mitterer_Alm_04.jpg" - assert sledding_cache.information == u"+43/664/5487520 (Mitterer Alm)" - assert sledding_cache.forum_threadid = 33 - assert sledding_cache.show_in_overview == True - - # assert sledding_cache.under_construction - def test_mediawiki_users(): users = wradmin.lib.mediawiki.MediaWikiUsers(True) diff --git a/wradmin/wradmin/tests/test_models.py b/wradmin/wradmin/tests/test_models.py index 96ca739..01ca6cf 100644 --- a/wradmin/wradmin/tests/test_models.py +++ b/wradmin/wradmin/tests/test_models.py @@ -72,13 +72,4 @@ def test_PhoneInfo(): v.to_python(n) # has to throw an exception assert False, u"The telephone info '%s' should throw an exception." % n except formencode.Invalid: pass - -def test_ValueCommentList(): - v = wradmin.model.validators.ValueCommentList() - assert v.to_python('abc') == [('abc', None)] - assert v.to_python(u'abc def') == [(u'abc def', None)] - assert v.to_python('value (comment)') == [('value', 'comment')] - assert v.to_python(u'value (comment)') == [(u'value', u'comment')] - assert v.to_python('value1 (comment); value2') == [('value1', 'comment'), ('value2', None)] - assert v.to_python('value1 (comment1); value2; value3 (comment3)') == [('value1', 'comment1'), ('value2', None), ('value3', 'comment3')] - assert v.to_python('value1 (comment1); value2 (test (not easy))') == [('value1', 'comment1'), ('value2', 'test (not easy)')] \ No newline at end of file + \ No newline at end of file