utils: allow ResourceUUID to convert UUID
Change-Id: I8c26811577bc8175917d1860c73ec266439d49dd
This commit is contained in:
@@ -1186,8 +1186,7 @@ class QueryTransformer(object):
|
||||
|
||||
if isinstance(attr.type, base.TimestampUTC):
|
||||
converter = utils.to_datetime
|
||||
elif (isinstance(attr.type, sqlalchemy_utils.UUIDType)
|
||||
and not isinstance(value, uuid.UUID)):
|
||||
elif isinstance(attr.type, sqlalchemy_utils.UUIDType):
|
||||
converter = utils.ResourceUUID
|
||||
elif isinstance(attr.type, types.String):
|
||||
converter = six.text_type
|
||||
|
||||
@@ -40,6 +40,8 @@ RESOURCE_ID_NAMESPACE = uuid.UUID('0a7a15ff-aa13-4ac2-897c-9bdf30ce175b')
|
||||
|
||||
|
||||
def ResourceUUID(value):
|
||||
if isinstance(value, uuid.UUID):
|
||||
return value
|
||||
if '/' in value:
|
||||
raise ValueError("'/' is not supported in resource id")
|
||||
try:
|
||||
|
||||
Reference in New Issue
Block a user