Closes #186 and fixes an issue with docker-compose

selenium-screenshot-testing
Kevin Chung 2017-01-06 18:20:56 -05:00
parent 09398b2ab0
commit 0e5c7aa972
2 changed files with 4 additions and 2 deletions

View File

@ -40,6 +40,8 @@ def create_app(config='CTFd.config'):
db.create_all()
except OperationalError:
db.create_all()
except ProgrammingError: ## Database already exists
pass
else:
db.create_all()

View File

@ -274,7 +274,7 @@ def delete_container(container_id):
@admins_only
def new_container():
name = request.form.get('name')
if set(name) <= set('abcdefghijklmnopqrstuvwxyz0123456789-_'):
if not set(name) <= set('abcdefghijklmnopqrstuvwxyz0123456789-_'):
return redirect(url_for('admin.list_container'))
buildfile = request.form.get('buildfile')
files = request.files.getlist('files[]')
@ -730,7 +730,7 @@ def admin_stats():
if len(solve_data):
most_solved = max(solve_data, key=solve_data.get)
least_solved = min(solve_data, key=solve_data.get)
db.session.expunge_all()
db.session.commit()
db.session.close()