diff piecrust/environment.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 e52241394791
children 0445a2232de7
line wrap: on
line diff
--- a/piecrust/environment.py	Fri Aug 29 16:41:16 2014 -0700
+++ b/piecrust/environment.py	Fri Aug 29 16:42:15 2014 -0700
@@ -3,6 +3,7 @@
 import json
 import logging
 import threading
+import collections
 import repoze.lru
 
 
@@ -40,7 +41,8 @@
                             logger.debug("'%s' found in file-system cache." %
                                          key)
                             item_raw = self.fs_cache.read(fs_key)
-                            item = json.loads(item_raw)
+                            item = json.loads(item_raw,
+                                    object_pairs_hook=collections.OrderedDict)
                             self.cache.put(key, item)
                             return item