refactor the getid method base.py
Refer to a merged commit. https://review.openstack.org/#/c/588983/ Change-Id: I4d92b2637d1176bef0df6e145f3515933f5a531a
This commit is contained in:
parent
dfe15c51b7
commit
8c19a8f813
@ -32,10 +32,7 @@ def getid(obj):
|
|||||||
Abstracts the common pattern of allowing both an object or an
|
Abstracts the common pattern of allowing both an object or an
|
||||||
object's ID (UUID) as a parameter when dealing with relationships.
|
object's ID (UUID) as a parameter when dealing with relationships.
|
||||||
"""
|
"""
|
||||||
try:
|
return getattr(obj, 'id', obj)
|
||||||
return obj.id
|
|
||||||
except AttributeError:
|
|
||||||
return obj
|
|
||||||
|
|
||||||
|
|
||||||
class Manager(object):
|
class Manager(object):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user