|
@@ -22,6 +22,7 @@ from flask import Flask
|
|
|
from flask import url_for
|
|
from flask import url_for
|
|
|
from flask import render_template
|
|
from flask import render_template
|
|
|
from flask import request
|
|
from flask import request
|
|
|
|
|
+from flask import redirect
|
|
|
app = Flask(__name__)
|
|
app = Flask(__name__)
|
|
|
|
|
|
|
|
|
|
|
|
@@ -97,3 +98,22 @@ def myCar_conf():
|
|
|
# !!! default vaules when the config file is not present
|
|
# !!! default vaules when the config file is not present
|
|
|
return render_template('conf/main.html', config=myCar_config, sections=myCar_config.sections())
|
|
return render_template('conf/main.html', config=myCar_config, sections=myCar_config.sections())
|
|
|
|
|
|
|
|
|
|
+
|
|
|
|
|
+@app.route('/confsave', methods=['POST'])
|
|
|
|
|
+def myCar_conf_save():
|
|
|
|
|
+ # this method saves the configuration settings when posted, then redirects to context /conf
|
|
|
|
|
+
|
|
|
|
|
+ if request is not None and request.form['configsend'] == 'save':
|
|
|
|
|
+
|
|
|
|
|
+ myCar_config['paths'] = { 'app' : request.form['[paths][app]'],
|
|
|
|
|
+ 'log' : request.form['[paths][log]'],
|
|
|
|
|
+ 'record' : request.form['[paths][record]'] }
|
|
|
|
|
+
|
|
|
|
|
+ myCar_config['connections'] = { 'bt_dev' : request.form['[connections][bt_dev]'],
|
|
|
|
|
+ 'gps_dev' : request.form['[connections][gps_dev]'],
|
|
|
|
|
+ 'wifi_pwd' : request.form['[connections][wifi_pwd]'] }
|
|
|
|
|
+ lib.config.myCar_save_config(myCar_config)
|
|
|
|
|
+
|
|
|
|
|
+ return redirect(url_for('myCar_conf'), code=302)
|
|
|
|
|
+
|
|
|
|
|
+
|