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