From 9ba008b7c87d3db7e83d17542e153554075fa083 Mon Sep 17 00:00:00 2001 From: pjenvey Date: Thu, 21 Dec 2006 21:57:56 +0000 Subject: restore the popped paste.config to environ when appropriate --- paste/deploy/config.py | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'paste/deploy/config.py') diff --git a/paste/deploy/config.py b/paste/deploy/config.py index bf271a3..dd81195 100644 --- a/paste/deploy/config.py +++ b/paste/deploy/config.py @@ -154,6 +154,9 @@ class ConfigMiddleware(object): import pkg_resources pkg_resources.require('Paste') from paste import wsgilib + popped_config = None + if 'paste.config' in environ: + popped_config = environ['paste.config'] conf = environ['paste.config'] = self.config.copy() app_iter = None CONFIG.push_thread_config(conf) @@ -163,11 +166,15 @@ class ConfigMiddleware(object): if app_iter is None: # An error occurred... CONFIG.pop_thread_config(conf) + if popped_config is not None: + environ['paste.config'] = popped_config if type(app_iter) in (list, tuple): # Because it is a concrete iterator (not a generator) we # know the configuration for this thread is no longer # needed: CONFIG.pop_thread_config(conf) + if popped_config is not None: + environ['paste.config'] = popped_config return app_iter else: def close_config(): -- cgit v1.2.1