- Fixed the call to get_committed_value() on CompositeProperty.

[ticket:1504]
This commit is contained in:
Mike Bayer
2009-11-03 04:54:56 +00:00
parent 659ca0c508
commit cc9c615c5a
4 changed files with 19 additions and 2 deletions
+3
View File
@@ -659,6 +659,9 @@ CHANGES
duplicate extensions, such as backref populators,
from being inserted into the list.
[ticket:1585]
- Fixed the call to get_committed_value() on CompositeProperty.
[ticket:1504]
- sql
- Fixed the "numeric" paramstyle, which apparently is the
+1 -1
View File
@@ -1628,7 +1628,7 @@ class Mapper(object):
if polymorphic_on is not None:
discriminator = row[polymorphic_on]
if discriminator is not None:
if discriminator is not None or None in polymorphic_instances:
_instance = polymorphic_instances[discriminator]
if _instance:
return _instance(row, result)
+2 -1
View File
@@ -161,7 +161,8 @@ class CompositeProperty(ColumnProperty):
return self.get_col_value(column, obj)
def getcommitted(self, state, column, passive=False):
obj = state.get_impl(self.key).get_committed_value(state, passive=passive)
# TODO: no coverage here
obj = state.get_impl(self.key).get_committed_value(state, state.dict, passive=passive)
return self.get_col_value(column, obj)
def setattr(self, state, value, column):
+13
View File
@@ -101,6 +101,19 @@ class FalseDiscriminatorTest(_base.MappedTest):
assert d1.type is False
sess.expunge_all()
assert sess.query(Ding).one() is not None
def test_none_on_sub(self):
class Ding(object):pass
class Bat(Ding):pass
mapper(Ding, t1, polymorphic_on=t1.c.type, polymorphic_identity=False)
mapper(Bat, inherits=Ding, polymorphic_identity=True)
sess = create_session()
d1 = Ding()
sess.add(d1)
sess.flush()
assert d1.type is False
sess.expunge_all()
assert sess.query(Ding).one() is not None
class PolymorphicSynonymTest(_base.MappedTest):
@classmethod