Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class Transaction(object):
- def __init__(self):
- self.callbacks = []
- def on_commit(self, callback):
- self.callbacks.append(callback)
- def commit(self):
- for callback in self.callbacks:
- callback()
- transaction = Transaction()
- def update_guide_exp_visibility(exp_id):
- print "update_guide_exp_visibility({})".format(exp_id)
- update_guide_exp_visibility.delay = update_guide_exp_visibility
- def test():
- for exp_id in range(1, 11):
- transaction.on_commit(
- lambda: update_guide_exp_visibility.delay(exp_id)
- )
- test()
- transaction.commit()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement