Skip to content

Instantly share code, notes, and snippets.

@boris-42
Created May 28, 2014 22:00
Show Gist options
  • Save boris-42/2b41363b22596f6fc453 to your computer and use it in GitHub Desktop.
Save boris-42/2b41363b22596f6fc453 to your computer and use it in GitHub Desktop.
class PersistanceContextManager(object):
def create():
# prepare list_of_ctx
# self._create(list)
created_ctxt = []
try:
for ctx in list_of_ctx:
created_ctxt.append(ctx)
ctx.setup()
except:
for ctx in reverse(created_ctx):
try:
ctx.clenaup()
except:
pass
raise exceptions.ContextFailedToCreate()
def cleanup():
pass
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment