Skip to content

Commit

Permalink
task 7870 per docs we can use the faster try-finally method
Browse files Browse the repository at this point in the history
  • Loading branch information
Ralph Smith committed Jan 20, 2016
1 parent afbc2f7 commit 83afb7a
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions spire/wsgi/sessions.py
Expand Up @@ -107,8 +107,10 @@ def injecting_start_response(status, headers, exc_info=None):
headers.append(('Set-Cookie', self._construct_cookie(session)))
return start_response(status, headers, exc_info)

return ClosingIterator(application(environ, injecting_start_response),
lambda: self.store.save_if_modified(session))
try:
return application(environ, injecting_start_response)
finally:
self.store.save_if_modified(session)

def _construct_cookie(self, session, unset=False):
params = self.configuration['cookie']
Expand Down

0 comments on commit 83afb7a

Please sign in to comment.