Don't record changes for any model ending in 'Version'

This commit is contained in:
Lance Edgar 2018-06-07 12:35:00 -05:00
parent 0effd0b3b8
commit bac7ebab7e

View file

@ -1,8 +1,8 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8; -*-
################################################################################ ################################################################################
# #
# Rattail -- Retail Software Framework # Rattail -- Retail Software Framework
# Copyright © 2010-2017 Lance Edgar # Copyright © 2010-2018 Lance Edgar
# #
# This file is part of Rattail. # This file is part of Rattail.
# #
@ -129,7 +129,16 @@ class ChangeRecorder(object):
""" """
Return ``True`` if changes for the given object should be ignored. Return ``True`` if changes for the given object should be ignored.
""" """
return isinstance(obj, self.ignored_classes) # ignore certain classes per declaration
if isinstance(obj, self.ignored_classes):
return True
# TODO: is there a smarter way to check?
# definitely don't care about changes to any version tables
if obj.__class__.__name__.endswith('Version'):
return True
return False
def process_new_object(self, session, obj): def process_new_object(self, session, obj):
""" """