From 2d4caba9e19cf4fe5953402bede7b5f7e20638bf Mon Sep 17 00:00:00 2001 From: Konsta Vesterinen Date: Tue, 5 May 2015 13:34:11 +0300 Subject: [PATCH] Fix GenericRelationshipProperty Make GenericRelationshipProperty work with SA 1.0.x, refs #139 --- CHANGES.rst | 3 ++- sqlalchemy_utils/generic.py | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/CHANGES.rst b/CHANGES.rst index 1da042c..44bacac 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -4,9 +4,10 @@ Changelog Here you can see the full list of changes between each SQLAlchemy-Utils release. -0.30.1 (2015-05-xx) +0.30.1 (2015-05-05) ^^^^^^^^^^^^^^^^^^^ +- Fixed GenericRelationshipProperty comparator to work with SA 1.0.x (#139) - Make translation_hybrid expression work the same way as SQLAlchemy-i18n translation expressions diff --git a/sqlalchemy_utils/generic.py b/sqlalchemy_utils/generic.py index d117e0c..e466316 100644 --- a/sqlalchemy_utils/generic.py +++ b/sqlalchemy_utils/generic.py @@ -94,6 +94,7 @@ class GenericRelationshipProperty(MapperProperty): """ def __init__(self, discriminator, id, doc=None): + super(GenericRelationshipProperty, self).__init__() self._discriminator_col = discriminator self._id_cols = id self._id = None @@ -138,10 +139,9 @@ class GenericRelationshipProperty(MapperProperty): self.id = list(map(self._column_to_property, self._id_cols)) class Comparator(PropComparator): - def __init__(self, prop, parentmapper): self.property = prop - self._parentmapper = parentmapper + self._parententity = parentmapper def __eq__(self, other): discriminator = six.text_type(type(other).__name__)