|
@@ -11,7 +11,8 @@ from email import utils
|
|
|
from os.path import join, dirname
|
|
|
|
|
|
|
|
|
-from bottle import route, run, static_file, request, template, FormsDict, redirect, response
|
|
|
+from bottle import route, run, static_file, request, template, FormsDict, redirect, response, Bottle
|
|
|
+
|
|
|
|
|
|
ORIENTATIONS = (
|
|
|
('N', 'Nord'),
|
|
@@ -70,11 +71,13 @@ GEOJSON_NAME = 'public.json'
|
|
|
|
|
|
ANTISPAM_FIELD = 'url'
|
|
|
|
|
|
-@route('/')
|
|
|
+app = Bottle()
|
|
|
+
|
|
|
+@app.route(URL_PREFIX+'/')
|
|
|
def home():
|
|
|
redirect("/wifi-form")
|
|
|
|
|
|
-@route('/wifi-form')
|
|
|
+@app.route('/wifi-form')
|
|
|
def show_wifi_form():
|
|
|
return template('wifi-form', errors=None, data = FormsDict(),
|
|
|
orientations=ORIENTATIONS, geojson=GEOJSON_NAME)
|
|
@@ -103,7 +106,7 @@ VALUES (:name, :contrib_type, :latitude, :longitude, :phone, :email, :access_typ
|
|
|
:privacy_name, :privacy_email, :privacy_place_details, :privacy_coordinates, :privacy_comment, :date)
|
|
|
""".format(TABLE_NAME), tosave)
|
|
|
|
|
|
-@route('/wifi-form', method='POST')
|
|
|
+@app.route('/wifi-form', method='POST')
|
|
|
def submit_wifi_form():
|
|
|
required = ('name', 'contrib-type',
|
|
|
'latitude', 'longitude')
|
|
@@ -196,16 +199,16 @@ def submit_wifi_form():
|
|
|
|
|
|
return redirect(urlparse.urljoin(request.path,'thanks'))
|
|
|
|
|
|
-@route('/thanks')
|
|
|
+@app.route('/thanks')
|
|
|
def wifi_form_thanks():
|
|
|
return template('thanks')
|
|
|
|
|
|
-@route('/assets/<filename:path>')
|
|
|
+@app.route('/assets/<filename:path>')
|
|
|
def send_asset(filename):
|
|
|
return static_file(filename, root=join(dirname(__file__), 'assets'))
|
|
|
|
|
|
|
|
|
-@route('/legal')
|
|
|
+@app.route('/legal')
|
|
|
def legal():
|
|
|
return template('legal')
|
|
|
|
|
@@ -214,11 +217,11 @@ def legal():
|
|
|
Results Map
|
|
|
"""
|
|
|
|
|
|
-@route('/map')
|
|
|
+@app.route('/map')
|
|
|
def public_map():
|
|
|
return template('map', geojson=GEOJSON_NAME)
|
|
|
|
|
|
-@route('/public.json')
|
|
|
+@app.route('/public.json')
|
|
|
def public_geojson():
|
|
|
return static_file('public.json', root=join(dirname(__file__), 'json/'))
|
|
|
|
|
@@ -363,5 +366,5 @@ if __name__ == '__main__':
|
|
|
if sys.argv[1] == 'buildgeojson':
|
|
|
build_geojson()
|
|
|
else:
|
|
|
- run(host=LISTEN_ADDR, port=LISTEN_PORT, reloader=DEBUG)
|
|
|
+ run(app, host=LISTEN_ADDR, port=LISTEN_PORT, reloader=DEBUG)
|
|
|
DB.close()
|