-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathedit.py
More file actions
34 lines (28 loc) · 769 Bytes
/
edit.py
File metadata and controls
34 lines (28 loc) · 769 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#!/usr/bin/env python3
from flask import Flask, request
from make import make_leaflet
import webbrowser
app = Flask(__name__)
@app.route('/')
def index():
return open('index.html').read()
@app.route('/building', methods=('POST', ))
def building():
print(request.form['title'])
stadtteil = request.form['stadtteil'].title()
title = request.form['title']
coords = request.form['coords']
filename = 'data/buildings/stadt/'+stadtteil+'-'+title.replace('-', ' ').title().replace(' ', '')
try:
open(filename, 'r')
except:
pass
else:
return ''
f = open(filename, 'w')
f.write(title+'\n'+coords+'\n\nKeine Notizen.\n')
f.close()
make_leaflet()
return 'ok'
make_leaflet()
app.run(debug=True)