From 0e5c7aa972d36cd421b18da96c1e136c348f0a13 Mon Sep 17 00:00:00 2001 From: Kevin Chung Date: Fri, 6 Jan 2017 18:20:56 -0500 Subject: [PATCH] Closes #186 and fixes an issue with docker-compose --- CTFd/__init__.py | 2 ++ CTFd/admin.py | 4 ++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/CTFd/__init__.py b/CTFd/__init__.py index 64afd56..98c4078 100644 --- a/CTFd/__init__.py +++ b/CTFd/__init__.py @@ -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() diff --git a/CTFd/admin.py b/CTFd/admin.py index 7887c25..048d323 100644 --- a/CTFd/admin.py +++ b/CTFd/admin.py @@ -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()