Commit 5bbcba48 authored by Floreal Cabanettes's avatar Floreal Cabanettes
Browse files

Fix clean jobs

parent 176ad29a
......@@ -47,15 +47,16 @@ def parse_database(app_data, max_age, fake=False):
is_gallery = len(Gallery.select().join(Job).where(Job.id_job == id_job)) > 0
if is_gallery:
gallery_jobs.append(id_job)
print("Removing job %s..." % id_job)
data_dir = os.path.join(app_data, id_job)
if os.path.exists(data_dir) and os.path.isdir(data_dir):
if not fake:
shutil.rmtree(data_dir)
else:
print("Job %s has no data folder!" % id_job)
if not fake:
job.delete_instance()
print("Removing job %s..." % id_job)
data_dir = os.path.join(app_data, id_job)
if os.path.exists(data_dir) and os.path.isdir(data_dir):
if not fake:
shutil.rmtree(data_dir)
else:
print("Job %s has no data folder!" % id_job)
if not fake:
job.delete_instance()
return gallery_jobs
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment