diff piecrust/baking/single.py @ 264:74bea91c9630

bake: Don't store internal config values in the bake record. We sometimes store actual objects in the page config (like for instance page linkers) and we don't want that to be pickled.
author Ludovic Chabant <ludovic@chabant.com>
date Tue, 24 Feb 2015 23:18:23 -0800
parents 61145dcd56e0
children 8c0c53a315ae
line wrap: on
line diff
--- a/piecrust/baking/single.py	Tue Feb 24 22:07:11 2015 -0800
+++ b/piecrust/baking/single.py	Tue Feb 24 23:18:23 2015 -0800
@@ -17,6 +17,14 @@
 logger = logging.getLogger(__name__)
 
 
+def copy_public_page_config(config):
+    res = config.get().copy()
+    for k in list(res.keys()):
+        if k.startswith('__'):
+            del res[k]
+    return res
+
+
 class BakingError(Exception):
     pass
 
@@ -98,7 +106,7 @@
         has_more_subs = True
         force_this = self.force
         invalidate_formatting = False
-        record_entry.config = page.config.get().copy()
+        record_entry.config = copy_public_page_config(page.config)
         prev_record_entry = self.record.getPreviousEntry(
                 factory.source.name, factory.rel_path,
                 taxonomy_name, taxonomy_term)