diff piecrust/environment.py @ 991:1857dbd4580f

bake: Fix bugs introduced by bake optimizations, of course. - Make the execution stats JSON-serializable. - Re-add ability to differentiate between sources used during segment rendering and during layout rendering. Fixes problems with cache invalidation of pages that use other sources. - Make taxonomy-related stuff JSON-serializable.
author Ludovic Chabant <ludovic@chabant.com>
date Mon, 20 Nov 2017 23:06:47 -0800
parents 08e02c2a2a1a
children a9a592f655e3
line wrap: on
line diff
--- a/piecrust/environment.py	Sun Nov 19 14:29:52 2017 -0800
+++ b/piecrust/environment.py	Mon Nov 20 23:06:47 2017 -0800
@@ -60,6 +60,17 @@
             v = self.manifests.setdefault(oc, [])
             self.manifests[oc] = v + ov
 
+    def toData(self):
+        return {
+            'timers': self.timers.copy(),
+            'counters': self.counters.copy(),
+            'manifests': self.manifests.copy()}
+
+    def fromData(self, data):
+        self.timers = data['timers']
+        self.counters = data['counters']
+        self.manifests = data['manifests']
+
 
 class Environment:
     def __init__(self):