Fix some db.changes stuff for tests...

This commit is contained in:
Lance Edgar 2015-02-09 01:29:00 -06:00
parent ebe2ce8109
commit 08dd2d000a

View file

@ -116,6 +116,11 @@ class ChangeRecorder(object):
# Does the other class mapper's relationship wish to delete orphans? # Does the other class mapper's relationship wish to delete orphans?
# other_relationship = relationship.mapper.relationships[backref] # other_relationship = relationship.mapper.relationships[backref]
# Sometimes backrefs are tuples; first element is name.
if isinstance(backref, tuple):
backref = backref[0]
other_relationship = relationship.mapper.get_property(backref) other_relationship = relationship.mapper.get_property(backref)
if other_relationship.cascade.delete_orphan: if other_relationship.cascade.delete_orphan:
@ -137,10 +142,8 @@ class ChangeRecorder(object):
ignored. ignored.
""" """
# No need to record changes for changes. Must not use `isinstance()` # No need to record changes for changes.
# here due to mocking in tests. if isinstance(instance, model.Change):
if (hasattr(instance.__class__, '__tablename__')
and instance.__class__.__tablename__ == 'changes'):
return False return False
# No need to record changes for batch data. # No need to record changes for batch data.