Refactor the getid method base.py
Refer to a merged commit. https://review.openstack.org/#/c/588983/ Change-Id: I9765543c288370cfcdaaa930b2839e28b51a9380
This commit is contained in:
parent
946ef06dc6
commit
94f6864bf0
|
@ -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…
Reference in New Issue