diff piecrust/page.py @ 67:563ce5dd02af

I don't care what the YAML spec says, ordered maps are the only sane way.
author Ludovic Chabant <ludovic@chabant.com>
date Fri, 29 Aug 2014 16:42:15 -0700
parents fce061f8c2ed
children e293f08d954e
line wrap: on
line diff
--- a/piecrust/page.py	Fri Aug 29 16:41:16 2014 -0700
+++ b/piecrust/page.py	Fri Aug 29 16:42:15 2014 -0700
@@ -7,6 +7,7 @@
 import logging
 import datetime
 import dateutil.parser
+import collections
 from werkzeug.utils import cached_property
 from piecrust.configuration import (Configuration, ConfigurationError,
         parse_config_header)
@@ -184,7 +185,8 @@
     page_time = path_mtime or os.path.getmtime(path)
     if cache.isValid(cache_path, page_time):
         exec_info.was_cache_valid = True
-        cache_data = json.loads(cache.read(cache_path))
+        cache_data = json.loads(cache.read(cache_path),
+                object_pairs_hook=collections.OrderedDict)
         config = PageConfiguration(values=cache_data['config'],
                 validate=False)
         content = json_load_segments(cache_data['content'])