Last active
August 29, 2015 14:04
-
-
Save laurayco/840a5a76d34407dbc15e to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os | |
class TransactComplete: | |
def __init__(self,thing): | |
self.original_filename = thing.filename | |
self.thing = thing | |
thing.filename = "{}.pending".format(thing.filename) | |
def enter(self):return None | |
def exit(self,*a): | |
os.rename(self.original_filename,self.original_filename+".bak") | |
os.rename(self.original_filename+".pending",self.original_filename) | |
self.thing.filename = self.original_filename |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment