# HG changeset patch # User Ludovic Chabant # Date 1409902972 25200 # Node ID 28ea3e69d67e3aba8d97a9ac863f0e3fd5804be2 # Parent 0dd43c5f548434b62db8683c2092d898d6fc1299 Use the `OrderedDict` correctly when fresh-loading the app config. diff -r 0dd43c5f5484 -r 28ea3e69d67e piecrust/app.py --- a/piecrust/app.py Fri Sep 05 00:42:28 2014 -0700 +++ b/piecrust/app.py Fri Sep 05 00:42:52 2014 -0700 @@ -101,7 +101,7 @@ def _validateAll(self, values): # Put all the defaults in the `site` section. - default_sitec = { + default_sitec = collections.OrderedDict({ 'title': "Untitled PieCrust website", 'root': '/', 'default_format': DEFAULT_FORMAT, @@ -124,16 +124,16 @@ 'display_errors': True, 'enable_debug_info': True, 'use_default_content': True - } + }) sitec = values.get('site') if sitec is None: - sitec = {} + sitec = collections.OrderedDict() for key, val in default_sitec.items(): sitec.setdefault(key, val) values['site'] = sitec # Add a section for our cached information. - cachec = {} + cachec = collections.OrderedDict() values['__cache'] = cachec # Cache auto-format regexes. @@ -188,7 +188,7 @@ g_date_format = sitec.get('date_format', DEFAULT_DATE_FORMAT) # The normal pages and tags/categories. - sourcesc = {} + sourcesc = collections.OrderedDict() sourcesc['pages'] = { 'type': 'default', 'ignore_missing_dir': True, @@ -203,7 +203,7 @@ 'func': 'pcurl(path)'}) sitec['routes'] = routesc - taxonomiesc = {} + taxonomiesc = collections.OrderedDict() taxonomiesc['tags'] = { 'multiple': True, 'term': 'tag'} @@ -263,11 +263,11 @@ # If the user defined some additional sources/routes/taxonomies, # append them to the default ones. if orig_sources: - sourcesc += orig_sources + sourcesc.update(orig_sources) if orig_routes: routesc + orig_routes if orig_taxonomies: - taxonomiesc += orig_taxonomies + taxonomiesc.update(orig_taxonomies) # Validate sources/routes. sourcesc = sitec.get('sources')