Skip to content
Snippets Groups Projects
Commit 5bbcba48 authored by Floreal Cabanettes's avatar Floreal Cabanettes
Browse files

Fix clean jobs

parent 176ad29a
No related branches found
Tags v1.0.1
No related merge requests found
...@@ -47,15 +47,16 @@ def parse_database(app_data, max_age, fake=False): ...@@ -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 is_gallery = len(Gallery.select().join(Job).where(Job.id_job == id_job)) > 0
if is_gallery: if is_gallery:
gallery_jobs.append(id_job) 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: else:
print("Job %s has no data folder!" % id_job) print("Removing job %s..." % id_job)
if not fake: data_dir = os.path.join(app_data, id_job)
job.delete_instance() 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 return gallery_jobs
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment