when getting an object, if at least one is found, display errors but correctly return the found object

This commit is contained in:
Romain Bignon 2014-09-17 16:16:17 +02:00
commit d5a43991b6

View file

@ -260,11 +260,18 @@ class ReplApplication(Cmd, ConsoleApplication):
if getattr(actual_backend, method, None) is not None: if getattr(actual_backend, method, None) is not None:
new_backend_names.append(backend) new_backend_names.append(backend)
backend_names = tuple(new_backend_names) backend_names = tuple(new_backend_names)
try:
for backend, objiter in self.do(method, _id, backends=backend_names, fields=fields, **kargs): for backend, objiter in self.do(method, _id, backends=backend_names, fields=fields, **kargs):
if objiter: if objiter:
obj = objiter obj = objiter
if objiter.id == _id: if objiter.id == _id:
return obj return obj
except CallErrors as e:
if obj is not None:
self.bcall_errors_handler(e)
else:
raise
return obj return obj
def get_object_list(self, method=None, *args, **kwargs): def get_object_list(self, method=None, *args, **kwargs):