comparison piecrust/data/builder.py @ 985:74f4bde40fd0

data: Optimize page data so cheapest accessors are tried first.
author Ludovic Chabant <ludovic@chabant.com>
date Tue, 31 Oct 2017 09:28:35 -0700
parents d9059257743c
children 8adc27285d93
comparison
equal deleted inserted replaced
984:e7ca3c577305 985:74f4bde40fd0
62 62
63 # TODO: handle slugified taxonomy terms. 63 # TODO: handle slugified taxonomy terms.
64 64
65 site_data = app.config.getAll() 65 site_data = app.config.getAll()
66 providers_data = DataProvidersData(page) 66 providers_data = DataProvidersData(page)
67 data = MergedMapping([data, providers_data, site_data]) 67
68 # Put the site data first so that `MergedMapping` doesn't load stuff
69 # for nothing just to find a value that was in the YAML config all
70 # along.
71 data = MergedMapping([site_data, data, providers_data])
68 72
69 # Do this at the end because we want all the data to be ready to be 73 # Do this at the end because we want all the data to be ready to be
70 # displayed in the debugger window. 74 # displayed in the debugger window.
71 if (app.config.get('site/show_debug_info') and 75 if (app.config.get('site/show_debug_info') and
72 not app.config.get('baker/is_baking')): 76 not app.config.get('baker/is_baking')):