]> khamidou — GitHub mirrors - vcrpy.git/commitdiff
Remove Secure File Overwrite Support
authorKevin McCarthy <me@kevinmccarthy.org>
Sun, 10 Nov 2013 22:25:59 +0000 (12:25 -1000)
committerKevin McCarthy <me@kevinmccarthy.org>
Sun, 10 Nov 2013 22:25:59 +0000 (12:25 -1000)
Closes #42

README.md
vcr/persisters/filesystem.py

index 480a988693cee7f089a3832fe004422ee7227770..02439973326c4b35383f0d6c187a0d864757b1d3 100644 (file)
--- a/README.md
+++ b/README.md
@@ -257,7 +257,7 @@ This library is a work in progress, so the API might change on you.
 There are probably some [bugs](https://github.com/kevin1024/vcrpy/issues?labels=bug&page=1&state=open) floating around too.
 
 ##Changelog
-* 0.4.0: Change default request recording behavior for multiple requests.  If you make the same request multiple times to the same URL, the response might be different each time (maybe the response has a timestamp in it or something), so this will make the same request multiple times and save them all.  Then, when you are replaying the cassette, the responses will be played back in the same order in which they were received.  If you were making multiple requests to the same URL in a cassette before version 0.4.0, you might need to regenerate your cassette files.  Also, removes support for the cassette.play_count counter API, since individual requests aren't unique anymore.  A cassette might contain the same request several times.
+* 0.4.0: Change default request recording behavior for multiple requests.  If you make the same request multiple times to the same URL, the response might be different each time (maybe the response has a timestamp in it or something), so this will make the same request multiple times and save them all.  Then, when you are replaying the cassette, the responses will be played back in the same order in which they were received.  If you were making multiple requests to the same URL in a cassette before version 0.4.0, you might need to regenerate your cassette files.  Also, removes support for the cassette.play_count counter API, since individual requests aren't unique anymore.  A cassette might contain the same request several times.  Also removes secure overwrite feature since that was breaking overwriting files in Windows.
 * 0.3.5: Fix compatibility with requests 2.x
 * 0.3.4: Bugfix: close file before renaming it.  This fixes an issue on Windows.  Thanks @smallcode for the fix.
 * 0.3.3: Bugfix for error message when an unreigstered custom matcher
index 6a1a275332b1b9a22782ebd90b84900c1da20288..7eb61098844fee889f2f6d2a57b8e62876769d06 100644 (file)
@@ -3,21 +3,10 @@ import os
 
 
 class FilesystemPersister(object):
-    @classmethod
-    def _secure_write(cls, path, contents):
-        """
-        We'll overwrite the old version securely by writing out a temporary
-        version and then moving it to replace the old version
-        """
-        dirname, filename = os.path.split(path)
-        fd, name = tempfile.mkstemp(dir=dirname, prefix=filename)
-        with os.fdopen(fd, 'w') as fout:
-            fout.write(contents)
-        os.rename(name, path)
-
     @classmethod
     def write(cls, cassette_path, data):
         dirname, filename = os.path.split(cassette_path)
         if dirname and not os.path.exists(dirname):
             os.makedirs(dirname)
-        cls._secure_write(cassette_path, data)
+       with open(cassette_path, 'w') as f:
+           f.write(data)