From 80cfc8147abc9fe13edec4059012d4301f16eb60 Mon Sep 17 00:00:00 2001 From: Ming Hu Date: Fri, 9 Jul 2021 18:13:54 -0600 Subject: [PATCH] RRFS_dev2: sync with dev1 (#52) Sync with dev1 branch --- log_change.py | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/log_change.py b/log_change.py index 2f70bea619..219db4e306 100644 --- a/log_change.py +++ b/log_change.py @@ -174,9 +174,15 @@ def isdate(string): def isdomain(string): ''' Returns a bool after checking whether the input string meets the - requirements for a date string: YYYYMMDDHH. ''' - - return string.lower() in [d.lower() for d in DOMAINS] + requirements for a domain, or list of domains ''' + + string_list = [i.strip("[]\"', ") for i in string.split(',')] + domains = [d.lower() for d in DOMAINS] + for s in string_list: + if s.lower() not in domains: + print(f'{s} is not a valid domain') + return False + return True def load_externals(ext_path="Externals.cfg"): @@ -230,7 +236,7 @@ def logit(logfile, tmpfile): # Create a logfile backup just in case. Make it a hidden file. # Won't remove this one in the script in case something goes # wrong. - path, fname = os.path.abspath(logfile), os.path.basename(logfile) + path, fname = os.path.dirname(logfile), os.path.basename(logfile) shutil.copy(logfile, os.path.join(path, f".{fname}._bk")) # Write the contents of the logfile to the tempfile for reverse