UUIDType now detects postgresql dialect correctly
It was inconsistent. When creating the field it used dialect.name, but in other places it just used dialect.
This commit is contained in:
@@ -59,7 +59,7 @@ class UUIDType(types.TypeDecorator, ScalarCoercible):
|
|||||||
if not isinstance(value, uuid.UUID):
|
if not isinstance(value, uuid.UUID):
|
||||||
value = self._coerce(value)
|
value = self._coerce(value)
|
||||||
|
|
||||||
if dialect == 'postgresql':
|
if dialect.name == 'postgresql':
|
||||||
return str(value)
|
return str(value)
|
||||||
|
|
||||||
return value.bytes if self.binary else value.hex
|
return value.bytes if self.binary else value.hex
|
||||||
@@ -68,7 +68,7 @@ class UUIDType(types.TypeDecorator, ScalarCoercible):
|
|||||||
if value is None:
|
if value is None:
|
||||||
return value
|
return value
|
||||||
|
|
||||||
if dialect == 'postgresql':
|
if dialect.name == 'postgresql':
|
||||||
return uuid.UUID(value)
|
return uuid.UUID(value)
|
||||||
|
|
||||||
return uuid.UUID(bytes=value) if self.binary else uuid.UUID(value)
|
return uuid.UUID(bytes=value) if self.binary else uuid.UUID(value)
|
||||||
|
Reference in New Issue
Block a user