def setUp(self): super(MementoCase, self).setUp() from camelot.core.memento import SqlMemento, memento_types global memento_id_counter custom_memento_types = memento_types + [(100, 'custom')] self.memento = SqlMemento(memento_types=custom_memento_types) memento_id_counter += 1 self.id_counter = memento_id_counter self.model = 'TestMemento'
def get_memento( self ): """Returns an instance of :class:`camelot.core.memento.SqlMemento` that can be used to store changes made to objects. Overwrite this method to make it return `None` if no changes should be stored to the database, or to return another instance if the changes should be stored elsewhere. :return: `None` or an :class:`camelot.core.memento.SqlMemento` instance """ from camelot.core.memento import SqlMemento if self._memento == None: self._memento = SqlMemento() return self._memento