Python3 compatability
This commit is contained in:
Kevin Chung
2017-03-08 00:45:33 -05:00
parent 05ff3afe8c
commit 41eaa56232
4 changed files with 5 additions and 5 deletions

View File

@@ -7,7 +7,7 @@ from sqlalchemy.engine.url import make_url
from sqlalchemy.exc import OperationalError, ProgrammingError
from sqlalchemy_utils import database_exists, create_database
from utils import get_config, set_config, cache, migrate, migrate_upgrade
from CTFd.utils import get_config, set_config, cache, migrate, migrate_upgrade
__version__ = '1.0.0'

View File

@@ -2,7 +2,7 @@ import os
##### GENERATE SECRET KEY #####
with open('.ctfd_secret_key', 'a+') as secret:
with open('.ctfd_secret_key', 'a+b') as secret:
secret.seek(0) # Seek to beginning of file since a+ mode leaves you at the end and w+ deletes the file
key = secret.read()
if not key:
@@ -23,7 +23,7 @@ class Config(object):
http://flask.pocoo.org/docs/0.11/quickstart/#sessions
'''
SECRET_KEY = key
SECRET_KEY = os.environ.get('SECRET_KEY') or key
'''

View File

@@ -10,7 +10,7 @@ from sqlalchemy.exc import DatabaseError
def sha512(string):
return hashlib.sha512(string).hexdigest()
return str(hashlib.sha512(string).hexdigest())
def ip2long(ip):

View File

@@ -5,7 +5,7 @@ import os
def init_plugins(app):
modules = glob.glob(os.path.dirname(__file__) + "/*")
blacklist = {'keys', 'challenges'}
blacklist = {'keys', 'challenges', '__pycache__'}
for module in modules:
module_name = os.path.basename(module)
if os.path.isdir(module) and module_name not in blacklist: