Fix GenericRelationshipProperty

Make GenericRelationshipProperty work with SA 1.0.x, refs #139
This commit is contained in:
Konsta Vesterinen
2015-05-05 13:34:11 +03:00
parent 98b7800efe
commit 2d4caba9e1
2 changed files with 4 additions and 3 deletions

View File

@@ -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

View File

@@ -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__)