def savestore(self): """Saves to temporary file then moves over original file. This way we avoid the need for locking. """ import shutil from pootle.core.utils import ptempfile as tempfile tmpfile, tmpfilename = tempfile.mkstemp(suffix=self.filename) os.close(tmpfile) self.store.savefile(tmpfilename) shutil.move(tmpfilename, self.realpath) self._touch_store_cache()