Made input and global config tags optional in config.xml.

This commit is contained in:
dhurd 2012-08-09 17:18:12 -04:00
parent 730f634ba4
commit beb81fa4ba

View File

@ -262,10 +262,12 @@ class Database:
# Iterates through an XML configuration file to find all given elements # Iterates through an XML configuration file to find all given elements
def run_config_test(config_file): def run_config_test(config_file):
try: #try:
parsed = parse(config_file) parsed = parse(config_file)
case.input_dir = parsed.getElementsByTagName("indir")[0].getAttribute("value").encode() if parsed.getElementsByTagName("indir"):
case.global_csv = parsed.getElementsByTagName("global_csv")[0].getAttribute("value").encode() case.input_dir = parsed.getElementsByTagName("indir")[0].getAttribute("value").encode()
if parsed.getElementsByTagName("global_csv"):
case.global_csv = parsed.getElementsByTagName("global_csv")[0].getAttribute("value").encode()
# Generate the top navbar of the HTML for easy access to all images # Generate the top navbar of the HTML for easy access to all images
values = [] values = []
@ -283,9 +285,9 @@ def run_config_test(config_file):
else: else:
printerror("Warning: Image file listed in the configuration does not exist:") printerror("Warning: Image file listed in the configuration does not exist:")
printerror(value + "\n") printerror(value + "\n")
except Exception as e: #except Exception as e:
printerror("Error: There was an error running with the configuration file.") #printerror("Error: There was an error running with the configuration file.")
printerror(str(e) + "\n") #printerror(str(e) + "\n")
# Runs the test on the single given file. # Runs the test on the single given file.
# The path must be guarenteed to be a correct path. # The path must be guarenteed to be a correct path.