Do not return None objects on get_object
Fix the "bug" of passing urls to videoob with multiple backends.
This commit is contained in:
parent
6a34a874bd
commit
8b2ced6dc5
1 changed files with 6 additions and 4 deletions
|
|
@ -235,10 +235,12 @@ class ReplApplication(Cmd, ConsoleApplication):
|
||||||
backend_names = (backend_name,) if backend_name is not None else self.enabled_backends
|
backend_names = (backend_name,) if backend_name is not None else self.enabled_backends
|
||||||
|
|
||||||
# if backend's service returns several objects, try to find the one
|
# if backend's service returns several objects, try to find the one
|
||||||
# with wanted ID. If not found, get the last object.
|
# with wanted ID. If not found, get the last not None object.
|
||||||
obj = None
|
obj = None
|
||||||
for backend, obj 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 obj and obj.id == _id:
|
if objiter:
|
||||||
|
obj = objiter
|
||||||
|
if objiter.id == _id:
|
||||||
return obj
|
return obj
|
||||||
return obj
|
return obj
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue