diff --git a/solvable/src/event_handler_main.py b/solvable/src/event_handler_main.py index 2774505..297f132 100644 --- a/solvable/src/event_handler_main.py +++ b/solvable/src/event_handler_main.py @@ -2,7 +2,8 @@ from ast import literal_eval from tornado.ioloop import IOLoop -from tfw.components import IdeEventHandler, TerminalEventHandler, ProcessManagingEventHandler, BashMonitor +from tfw.components import IdeEventHandler, TerminalEventHandler +from tfw.components import ProcessManagingEventHandler, BashMonitor from tfw.components import TerminalCommands, LogMonitoringEventHandler from tfw.networking import MessageSender, TFWServerConnector from tfw.config import TFWENV @@ -54,8 +55,10 @@ class TestCommands(TerminalCommands): This can speed up development when combined with mounting volumes from host to container. """ - seppuku = ('nohup sh -c "supervisorctl restart tfwserver event_handler_main" &> /dev/null & ' - 'clear && echo "Committed seppuku! :)" && sleep infinity') + seppuku = ( + 'nohup sh -c "supervisorctl restart tfwserver event_handler_main" &> /dev/null & ' + 'clear && echo "Committed seppuku! :)" && sleep infinity' + ) uplink = TFWServerConnector() uplink.send_to_eventhandler({ 'key': 'shell', diff --git a/solvable/src/webservice/model.py b/solvable/src/webservice/model.py index f135b25..2439684 100644 --- a/solvable/src/webservice/model.py +++ b/solvable/src/webservice/model.py @@ -6,9 +6,11 @@ from sqlalchemy.orm import sessionmaker engine = create_engine('sqlite:///db.db', convert_unicode=True) -session_factory = sessionmaker(autocommit=False, - autoflush=False, - bind=engine) +session_factory = sessionmaker( + autocommit=False, + autoflush=False, + bind=engine +) @contextmanager diff --git a/solvable/src/webservice/server.py b/solvable/src/webservice/server.py index cc84ecb..6f4aab7 100644 --- a/solvable/src/webservice/server.py +++ b/solvable/src/webservice/server.py @@ -10,7 +10,9 @@ BASEURL = getenv('BASEURL', '') init_db() app = Flask(__name__) app.secret_key = urandom(32) -app.jinja_env.globals.update(get_url=lambda endpoint: f'{BASEURL}{url_for(endpoint)}') # pylint: disable=no-member +app.jinja_env.globals.update( # pylint: disable=no-member + get_url=lambda endpoint: f'{BASEURL}{url_for(endpoint)}' +) def get_db_session(): @@ -47,22 +49,33 @@ def index(): @app.route('/register', methods=['GET', 'POST']) def register(): if request.method == 'POST': - if not all([request.form.get('username'), - request.form.get('password'), - request.form.get('passwordconfirm')]): + form_filled_out = all([ + request.form.get('username'), + request.form.get('password'), + request.form.get('passwordconfirm') + ]) + + if not form_filled_out: return render_template('register.html', alert='You need to fill everything.') if request.form['password'] != request.form['passwordconfirm']: return render_template('register.html', alert='Passwords do not match! Please try again.') try: - UserOps(request.form.get('username'), - request.form.get('password'), - get_db_session()).register() + UserOps( + request.form.get('username'), + request.form.get('password'), + get_db_session() + ).register() except UserExistsError: return render_template('register.html', alert='Username already in use.') - return render_template('login.html', success=('Account "{}" successfully registered. ' - 'You can log in now!'.format(request.form['username']))) + return render_template( + 'login.html', + success=( + 'Account "{}" successfully registered. ' + 'You can log in now!'.format(request.form['username']) + ) + ) return render_template('register.html')