Browse Source

Error checking, no ?

master
Dashie der otter 3 years ago
parent
commit
5aa1ea6a97
2 changed files with 4 additions and 0 deletions
  1. 2
    0
      models.py
  2. 2
    0
      utils.py

+ 2
- 0
models.py View File

@@ -478,6 +478,8 @@ def gen_user_barcode(mapper, connection, target):

def safe_delete(path):
""" Not really """
if not path: return
if os.path.isfile(path):
os.remove(path)


+ 2
- 0
utils.py View File

@@ -40,6 +40,8 @@ def path_or_none(fbase, ftype, fname):
:param fname: Filename
:return: Full path or None
"""
if not fbase or not ftype or not fname:
return None
fpath = os.path.join(fbase, ftype, fname)
return fpath if os.path.isfile(fpath) else None