diff --git a/bob/db/cuhk_cufs/query.py b/bob/db/cuhk_cufs/query.py index 098bafd8fba25910d295db86a78f443b132285c7..7a1458f00f76fc5dcc0d9b29f6638c0a4af05605 100644 --- a/bob/db/cuhk_cufs/query.py +++ b/bob/db/cuhk_cufs/query.py @@ -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):