Fix py33 support
This commit is contained in:
@@ -74,7 +74,7 @@ class GenericAttributeImpl(attributes.ScalarAttributeImpl):
|
||||
pk = mapper.identity_key_from_instance(initiator)[1]
|
||||
|
||||
# Set the identifier and the discriminator.
|
||||
discriminator = unicode(class_.__name__)
|
||||
discriminator = six.text_type(class_.__name__)
|
||||
|
||||
for index, id in enumerate(self.parent_token.id):
|
||||
dict_[id.key] = pk[index]
|
||||
@@ -144,7 +144,7 @@ class GenericRelationshipProperty(MapperProperty):
|
||||
self._parentmapper = parentmapper
|
||||
|
||||
def __eq__(self, other):
|
||||
discriminator = unicode(type(other).__name__)
|
||||
discriminator = six.text_type(type(other).__name__)
|
||||
q = self.property._discriminator_col == discriminator
|
||||
other_id = identity(other)
|
||||
for index, id in enumerate(self.property._id_cols):
|
||||
@@ -158,9 +158,9 @@ class GenericRelationshipProperty(MapperProperty):
|
||||
mapper = sa.inspect(other)
|
||||
# Iterate through the weak sequence in order to get the actual
|
||||
# mappers
|
||||
class_names = [unicode(other.__name__)]
|
||||
class_names = [six.text_type(other.__name__)]
|
||||
class_names.extend([
|
||||
unicode(submapper.class_.__name__)
|
||||
six.text_type(submapper.class_.__name__)
|
||||
for submapper in mapper._inheriting_mappers
|
||||
])
|
||||
|
||||
|
@@ -1,4 +1,5 @@
|
||||
from __future__ import unicode_literals
|
||||
import six
|
||||
from tests import TestCase
|
||||
|
||||
|
||||
@@ -16,7 +17,7 @@ class GenericRelationshipTestCase(TestCase):
|
||||
|
||||
event = self.Event()
|
||||
event.object_id = user.id
|
||||
event.object_type = unicode(type(user).__name__)
|
||||
event.object_type = six.text_type(type(user).__name__)
|
||||
|
||||
assert event.object is None
|
||||
|
||||
|
@@ -1,4 +1,5 @@
|
||||
from __future__ import unicode_literals
|
||||
import six
|
||||
import sqlalchemy as sa
|
||||
from sqlalchemy_utils import generic_relationship
|
||||
from tests.generic_relationship import GenericRelationshipTestCase
|
||||
@@ -52,7 +53,7 @@ class TestGenericRelationship(GenericRelationshipTestCase):
|
||||
|
||||
event = self.Event()
|
||||
event.object_id = user.id
|
||||
event.object_type = unicode(type(user).__name__)
|
||||
event.object_type = six.text_type(type(user).__name__)
|
||||
event.object_code = user.code
|
||||
|
||||
assert event.object is None
|
||||
|
@@ -1,4 +1,5 @@
|
||||
from __future__ import unicode_literals
|
||||
import six
|
||||
import sqlalchemy as sa
|
||||
from sqlalchemy.ext.hybrid import hybrid_property
|
||||
from sqlalchemy_utils import generic_relationship
|
||||
@@ -55,7 +56,7 @@ class TestGenericRelationship(TestCase):
|
||||
|
||||
event = self.Event(transaction_id=1)
|
||||
event.object_id = user.id
|
||||
event.object_type = unicode(type(user).__name__)
|
||||
event.object_type = six.text_type(type(user).__name__)
|
||||
assert event.object is None
|
||||
|
||||
self.session.add(event)
|
||||
|
@@ -1,4 +1,5 @@
|
||||
from __future__ import unicode_literals
|
||||
import six
|
||||
import sqlalchemy as sa
|
||||
from sqlalchemy_utils import generic_relationship
|
||||
from tests import TestCase
|
||||
@@ -54,7 +55,7 @@ class TestGenericRelationship(TestCase):
|
||||
|
||||
event = self.Event()
|
||||
event.object_id = manager.id
|
||||
event.object_type = unicode(type(manager).__name__)
|
||||
event.object_type = six.text_type(type(manager).__name__)
|
||||
|
||||
assert event.object is None
|
||||
|
||||
|
Reference in New Issue
Block a user