diff options
author | pjenvey <devnull@localhost> | 2006-08-11 03:34:12 +0000 |
---|---|---|
committer | pjenvey <devnull@localhost> | 2006-08-11 03:34:12 +0000 |
commit | fe9913b05a326d67dbc3d5569ac8266daee8ce73 (patch) | |
tree | 4096ee2da93cde0f550d8d3ab04e8a3dd32b1c31 /paste/deploy/config.py | |
parent | 78ec01b18c074937e1e1f07826e90725406d3c12 (diff) | |
download | pastedeploy-fe9913b05a326d67dbc3d5569ac8266daee8ce73.tar.gz |
avoid popping the thread's config twice when app_iter is None
Diffstat (limited to 'paste/deploy/config.py')
-rw-r--r-- | paste/deploy/config.py | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/paste/deploy/config.py b/paste/deploy/config.py index 11f3921..766e5d9 100644 --- a/paste/deploy/config.py +++ b/paste/deploy/config.py @@ -156,19 +156,21 @@ class ConfigMiddleware(object): conf = environ['paste.config'] = self.config.copy() app_iter = None CONFIG.push_thread_config(conf) + popped_config = False try: app_iter = self.application(environ, start_response) finally: if app_iter is None: # An error occurred... CONFIG.pop_thread_config(conf) + popped_config = True 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) return app_iter - else: + elif not popped_config: def close_config(): CONFIG.pop_thread_config(conf) new_app_iter = wsgilib.add_close(app_iter, close_config) |