mirror of
https://github.com/avatao-content/test-tutorial-framework
synced 2024-11-12 19:37:16 +00:00
Harmonize code formatting style across project
This commit is contained in:
parent
60986fa51d
commit
12c95a198b
@ -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',
|
||||
|
@ -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
|
||||
|
@ -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')
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user