3 Consists of functions to typically be used within templates, but also
4 available to Controllers. This module is available to templates as 'h'.
6 # Import helpers as desired, or define your own, ie:
7 #from webhelpers.html.tags import checkbox, password
10 import wrpylib.wrvalidators
11 from webhelpers.html.tags import file, form, end_form, submit
13 def wiki(page_title=None):
14 "Creates a link to the specified page in the www.winterrodeln.org wiki"
15 if page_title is None: page_title = 'Hauptseite'
16 return 'http://www.winterrodeln.org/wiki/' + page_title
19 def forum(forum=None):
20 "Creates a link to the specified forum. If no id is given, a general link is created."
21 if forum is None: return 'http://winterrodeln-forum.org/'
22 return 'http://winterrodeln-forum.org/viewforum.php?f=%d' % forum
25 def google_maps(latitude, longitude):
26 "Builds an URL like http://maps.google.at/maps?q=47.200607,11.260007"
27 return "http://maps.google.at/maps?q=%.6f,%.6f" % (latitude, longitude)
31 "Takes a bool value and creates a German representation"
32 return wrpylib.wrvalidators.GermanBoolNone().from_python(value)
35 def tristate_tuple(yes, no):
36 "Takes a German representation of a tristate value"
37 return wrpylib.wrvalidators.GermanTristateTuple().from_python((yes, no))
40 def tristate_float(value):
41 "Takes a German representation of a tristate value"
42 return wrpylib.wrvalidators.GermanTristateFloat().from_python(value)
45 def public_transport(value):
46 if isinstance(value, int): value = int(value)
47 return wrpylib.wrvalidators.GermanPublicTransport().from_python(value)