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