mirror of
https://github.com/sqlalchemy/sqlalchemy.git
synced 2026-06-02 05:48:52 -04:00
- Fixed the call to get_committed_value() on CompositeProperty.
[ticket:1504]
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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):
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user