Merge "refactor the getid method base.py"

This commit is contained in:
Zuul 2023-11-01 11:24:18 +00:00 committed by Gerrit Code Review
commit 2b7177a9f9
1 changed files with 1 additions and 4 deletions

View File

@ -32,10 +32,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):