comparison piecrust/baking/records.py @ 96:0445a2232de7

Improvements and fixes to incremental baking. * Better handling of the render pass during page rendering. * Used sources are paired with the pass they were used in. * Proper use and invalidation of the rendered segments cache based on render passes. * The `Assetor` is also better tracking what was used in a page. * Add flags on a page to get better caching information for the debug window. * Property invalidation of the previous bake record when needed. * Better information about why pages are delayed.
author Ludovic Chabant <ludovic@chabant.com>
date Sun, 07 Sep 2014 23:48:57 -0700
parents e88e330eb8dc
children 133845647083
comparison
equal deleted inserted replaced
95:cb6eadea0845 96:0445a2232de7
6 6
7 7
8 logger = logging.getLogger(__name__) 8 logger = logging.getLogger(__name__)
9 9
10 10
11 RECORD_VERSION = 4 11 RECORD_VERSION = 6
12 12
13 13
14 def _get_transition_key(source_name, rel_path, taxonomy_name=None, 14 def _get_transition_key(source_name, rel_path, taxonomy_name=None,
15 taxonomy_term=None): 15 taxonomy_term=None):
16 key = '%s:%s' % (source_name, rel_path) 16 key = '%s:%s' % (source_name, rel_path)
73 @property 73 @property
74 def transition_key(self): 74 def transition_key(self):
75 return _get_transition_key(self.source_name, self.rel_path, 75 return _get_transition_key(self.source_name, self.rel_path,
76 self.taxonomy_name, self.taxonomy_term) 76 self.taxonomy_name, self.taxonomy_term)
77 77
78 def addUsedSource(self, source):
79 if isinstance(source, PageSource):
80 self.used_source_names.add(source.name)
81
82 def __getstate__(self): 78 def __getstate__(self):
83 state = self.__dict__.copy() 79 state = self.__dict__.copy()
84 del state['path_mtime'] 80 del state['path_mtime']
85 return state 81 return state
86 82
107 self.previous = BakeRecord() 103 self.previous = BakeRecord()
108 return 104 return
109 105
110 for e in self.previous.entries: 106 for e in self.previous.entries:
111 self.transitions[e.transition_key] = (e, None) 107 self.transitions[e.transition_key] = (e, None)
108
109 def clearPrevious(self):
110 self.previous = BakeRecord()
112 111
113 def saveCurrent(self, current_path): 112 def saveCurrent(self, current_path):
114 self.current.save(current_path) 113 self.current.save(current_path)
115 114
116 def addEntry(self, entry): 115 def addEntry(self, entry):