Skip to content
Snippets Groups Projects
Commit c8a45584 authored by Martin Mareš's avatar Martin Mareš
Browse files

unlink_if_exists je trefnější jméno

parent de374df3
No related branches found
No related tags found
1 merge request!21Reforma uploadů
...@@ -67,10 +67,10 @@ class TheJob: ...@@ -67,10 +67,10 @@ class TheJob:
job = self.job job = self.job
if job.in_file is not None: if job.in_file is not None:
mo.util.unlink_if_needed(job_file_path(job.in_file)) mo.util.unlink_if_exists(job_file_path(job.in_file))
if job.out_file is not None: if job.out_file is not None:
mo.util.unlink_if_needed(job_file_path(job.out_file)) mo.util.unlink_if_exists(job_file_path(job.out_file))
sess.delete(job) sess.delete(job)
sess.commit() sess.commit()
......
...@@ -179,7 +179,7 @@ def link_to_dir(src: str, dest_dir: str, prefix: str = "", suffix: str = "") -> ...@@ -179,7 +179,7 @@ def link_to_dir(src: str, dest_dir: str, prefix: str = "", suffix: str = "") ->
logger.warning('Iteruji link_to_dir: %s už existuje', dest) logger.warning('Iteruji link_to_dir: %s už existuje', dest)
def unlink_if_needed(name: str): def unlink_if_exists(name: str):
try: try:
os.unlink(name) os.unlink(name)
except FileNotFoundError: except FileNotFoundError:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment