Mercurial > piecrust2
diff piecrust/records.py @ 91:e88e330eb8dc
Improvements to incremental baking and cache invalidating.
author | Ludovic Chabant <ludovic@chabant.com> |
---|---|
date | Fri, 05 Sep 2014 00:42:13 -0700 |
parents | 343d08ef5668 |
children | 133845647083 |
line wrap: on
line diff
--- a/piecrust/records.py Fri Sep 05 00:40:45 2014 -0700 +++ b/piecrust/records.py Fri Sep 05 00:42:13 2014 -0700 @@ -1,31 +1,18 @@ import os import os.path +import pickle import logging -from piecrust import APP_VERSION from piecrust.events import Event -try: - import pickle as pickle -except ImportError: - import pickle - logger = logging.getLogger(__name__) class Record(object): - VERSION = 1 - def __init__(self): - self.app_version = None - self.record_version = None self.entries = [] self.entry_added = Event() - def isVersionMatch(self): - return (self.app_version == APP_VERSION and - self.record_version == self.VERSION) - def addEntry(self, entry): self.entries.append(entry) self.entry_added.fire(entry) @@ -43,6 +30,11 @@ del odict['entry_added'] return odict + def __setstate__(self, state): + for k, v in state.items(): + setattr(self, k, v) + self.entry_added = Event() + @staticmethod def load(path): logger.debug("Loading bake record from: %s" % path)