mirror of
https://github.com/aljazceru/CTFd.git
synced 2025-12-17 22:14:25 +01:00
Fix some ideas from import testing (#2093)
* Add some local changes that didn't make it into the previous PR * Works on #2087
This commit is contained in:
@@ -437,9 +437,18 @@ def import_ctf(backup, erase=True):
|
|||||||
|
|
||||||
|
|
||||||
def background_import_ctf(backup):
|
def background_import_ctf(backup):
|
||||||
|
# Empty out import status trackers
|
||||||
|
cache.set("import_start_time", value=None)
|
||||||
|
cache.set("import_end_time", value=None)
|
||||||
|
cache.set("import_status", value=None)
|
||||||
|
cache.set("import_error", value=None)
|
||||||
|
|
||||||
# The manage.py script will delete the backup for us
|
# The manage.py script will delete the backup for us
|
||||||
f = tempfile.NamedTemporaryFile(delete=False)
|
f = tempfile.NamedTemporaryFile(delete=False)
|
||||||
|
|
||||||
|
# Store the backup file in our tempfile
|
||||||
backup.save(f.name)
|
backup.save(f.name)
|
||||||
|
|
||||||
python = sys.executable # Get path of Python interpreter
|
python = sys.executable # Get path of Python interpreter
|
||||||
manage_py = Path(app.root_path).parent / "manage.py" # Path to manage.py
|
manage_py = Path(app.root_path).parent / "manage.py" # Path to manage.py
|
||||||
subprocess.Popen( # nosec B603
|
subprocess.Popen( # nosec B603
|
||||||
|
|||||||
Reference in New Issue
Block a user