Refactor the getid method in novaclient/base.py
TrivialFix Change-Id: I30aa4cea658bd3b96f9e7e3d7037232fed8d3749
This commit is contained in:
parent
1f75c7662d
commit
045f641cec
@ -41,10 +41,7 @@ def getid(obj):
|
||||
Abstracts the common pattern of allowing both an object or an object's ID
|
||||
as a parameter when dealing with relationships.
|
||||
"""
|
||||
try:
|
||||
return obj.id
|
||||
except AttributeError:
|
||||
return obj
|
||||
return getattr(obj, 'id', obj)
|
||||
|
||||
|
||||
# TODO(aababilov): call run_hooks() in HookableMixin's child classes
|
||||
|
Loading…
Reference in New Issue
Block a user