Clean up some logging calls when recording instance changes.

This commit is contained in:
Lance Edgar 2015-11-05 01:33:59 -06:00
parent b8333e822c
commit 0b03551a58

View file

@ -93,10 +93,10 @@ class ChangeRecorder(object):
versioning_manager.before_flush(session, flush_context, instances) versioning_manager.before_flush(session, flush_context, instances)
for instance in session.deleted: for instance in session.deleted:
log.debug("ChangeRecorder: found deleted instance: {0}".format(repr(instance))) log.debug("found deleted instance: {0}".format(repr(instance)))
self.record_change(session, instance, deleted=True) self.record_change(session, instance, deleted=True)
for instance in session.new: for instance in session.new:
log.debug("ChangeRecorder: found new instance: {0}".format(repr(instance))) log.debug("found new instance: {0}".format(repr(instance)))
self.record_change(session, instance) self.record_change(session, instance)
for instance in session.dirty: for instance in session.dirty:
if session.is_modified(instance, passive=True): if session.is_modified(instance, passive=True):
@ -104,10 +104,10 @@ class ChangeRecorder(object):
# session.dirty instead of session.deleted, hence this check. # session.dirty instead of session.deleted, hence this check.
# See also https://groups.google.com/d/msg/sqlalchemy/H4nQTHphc0M/Xr8-Cgra0Z4J # See also https://groups.google.com/d/msg/sqlalchemy/H4nQTHphc0M/Xr8-Cgra0Z4J
if self.is_deletable_orphan(instance): if self.is_deletable_orphan(instance):
log.debug("ChangeRecorder: found orphan pending deletion: {0}".format(repr(instance))) log.debug("found orphan pending deletion: {0}".format(repr(instance)))
self.record_change(session, instance, deleted=True) self.record_change(session, instance, deleted=True)
else: else:
log.debug("ChangeRecorder: found dirty instance: {0}".format(repr(instance))) log.debug("found dirty instance: {0}".format(repr(instance)))
self.record_change(session, instance) self.record_change(session, instance)
def is_deletable_orphan(self, instance): def is_deletable_orphan(self, instance):
@ -215,7 +215,7 @@ class ChangeRecorder(object):
return return
instance.uuid = get_uuid() instance.uuid = get_uuid()
log.error("ChangeRecorder.ensure_uuid: unexpected scenario; generated new UUID for instance: {0}".format(repr(instance))) log.error("unexpected scenario; generated new UUID for instance: {0}".format(repr(instance)))
class ChangeRecorderExtension(SessionExtension): # pragma: no cover class ChangeRecorderExtension(SessionExtension): # pragma: no cover