changeset 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 a68e207ca406
children 07d53370724b
files piecrust/baking/single.py
diffstat 1 files changed, 9 insertions(+), 1 deletions(-) [+]
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)