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:
Nick Retallack
2014-02-10 21:03:02 -08:00
parent 7985d8a719
commit f777fb7240

View File

@@ -59,7 +59,7 @@ class UUIDType(types.TypeDecorator, ScalarCoercible):
if not isinstance(value, uuid.UUID):
value = self._coerce(value)
if dialect == 'postgresql':
if dialect.name == 'postgresql':
return str(value)
return value.bytes if self.binary else value.hex
@@ -68,7 +68,7 @@ class UUIDType(types.TypeDecorator, ScalarCoercible):
if value is None:
return value
if dialect == 'postgresql':
if dialect.name == 'postgresql':
return uuid.UUID(value)
return uuid.UUID(bytes=value) if self.binary else uuid.UUID(value)