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()