Skip to content

Instantly share code, notes, and snippets.

@adamcunnington
Created November 10, 2013 00:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save adamcunnington/28517d8e873dfaf664ea to your computer and use it in GitHub Desktop.
Save adamcunnington/28517d8e873dfaf664ea to your computer and use it in GitHub Desktop.
def __exit__(self, exc_type, exc_value, traceback):
try:
if exc_value is None:
self.session.commit()
finally:
self.session.close()
# Should it be this?
def __exit__(self, exc_type, exc_value, traceback):
if exc_value is None:
try:
self.session.commit()
finally:
self.session.close()
else:
self.sesion.close()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment