- when attributes are expired on a pending instance, an
error will not be raised when the "refresh" action
is triggered and returns no result
-
+
+ - fixed/covered case when using a False value as a
+ polymorphic discriminator
+
0.4.4
------
- sql
else:
self._synchronizer = None
self.mapped_table = self.local_table
- if self.polymorphic_identity:
+ if self.polymorphic_identity is not None:
self.inherits.polymorphic_map[self.polymorphic_identity] = self
if self.polymorphic_on is None:
for mapper in self.iterate_to_root():
self.assert_(compare == result)
self.assert_(l[0].parent_foo.data == 'foo #1' and l[1].parent_foo.data == 'foo #1')
+class FalseDiscriminatorTest(ORMTest):
+ def define_tables(self, metadata):
+ global t1
+ t1 = Table('t1', metadata, Column('id', Integer, primary_key=True), Column('type', Integer, nullable=False))
+
+ def test_false_discriminator(self):
+ class Foo(object):pass
+ class Bar(Foo):pass
+ mapper(Foo, t1, polymorphic_on=t1.c.type, polymorphic_identity=1)
+ mapper(Bar, inherits=Foo, polymorphic_identity=0)
+ sess = create_session()
+ f1 = Bar()
+ sess.save(f1)
+ sess.flush()
+ assert f1.type == 0
+
class CascadeTest(ORMTest):
"""that cascades on polymorphic relations continue
cascading along the path of the instance's mapper, not