From f777fb724083c4e7f2ad54e7ee5d64c1cc69c5fd Mon Sep 17 00:00:00 2001 From: Nick Retallack Date: Mon, 10 Feb 2014 21:03:02 -0800 Subject: [PATCH] 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. --- sqlalchemy_utils/types/uuid.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sqlalchemy_utils/types/uuid.py b/sqlalchemy_utils/types/uuid.py index 1ef201c..331eda6 100644 --- a/sqlalchemy_utils/types/uuid.py +++ b/sqlalchemy_utils/types/uuid.py @@ -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)