Commit 9a16aa36 authored by Tiago de Freitas Pereira's avatar Tiago de Freitas Pereira
Browse files

Fixed method original_file_name

parent 56db8f23
......@@ -74,10 +74,20 @@ class Database(bob.db.verification.utils.SQLiteDatabase, bob.db.verification.uti
if not original_directory or not self.original_extension:
raise ValueError("The original_directory and/or the original_extension were not specified in the constructor.")
# extract file name
file_name = file.make_path(original_directory, self.original_extension)
if not check_existence or os.path.exists(file_name):
return file_name
raise ValueError("The file '%s' was not found. Please check the original directory '%s' and extension '%s'?" % (file_name, original_directory, self.original_extension))
#file_name = file.make_path(original_directory, self.original_extension)
file_name=""
if check_existence:
if type(self.original_extension) is list:
for e in self.original_extension:
file_name = file.make_path(original_directory, e)
if os.path.exists(file_name):
return file_name
else:
file_name = file.make_path(original_directory, self.original_extension)
if os.path.exists(file_name):
return file_name
raise ValueError("The file '%s' was not found. Please check the original directory '%s' and extension '%s'?" % (file_name, original_directory, self.original_extension))
def objects(self, groups = None, protocol = None, purposes = None, model_ids = None, **kwargs):
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment