changeset 301:45aba3cb7228

config: Make YAML consider `omap` structures as normal maps.
author Ludovic Chabant <ludovic@chabant.com>
date Thu, 19 Mar 2015 18:28:42 -0700
parents 2daa05a21026
children 103abb08755e
files piecrust/configuration.py
diffstat 1 files changed, 4 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/piecrust/configuration.py	Wed Mar 11 23:48:35 2015 -0700
+++ b/piecrust/configuration.py	Thu Mar 19 18:28:42 2015 -0700
@@ -219,7 +219,10 @@
 
 class ConfigurationDumper(yaml.SafeDumper):
     def represent_ordered_dict(self, data):
-        return self.represent_mapping('tag:yaml.org,2002:omap', data)
+        # Not a typo: we're using `map` and not `omap` because we don't want
+        # ugly type tags printed in the generated YAML markup, and because
+        # we always load maps into `OrderedDicts` anyway.
+        return self.represent_mapping('tag:yaml.org,2002:map', data)
 
 
 ConfigurationDumper.add_representer(collections.OrderedDict,