Revision: 3166
          http://spambayes.svn.sourceforge.net/spambayes/?rev=3166&view=rev
Author:   montanaro
Date:     2007-10-21 19:44:14 -0700 (Sun, 21 Oct 2007)

Log Message:
-----------
Use the new safe_pickle function.  From Dave Abrahams (SF 1816240).

Modified Paths:
--------------
    trunk/spambayes/spambayes/classifier.py

Modified: trunk/spambayes/spambayes/classifier.py
===================================================================
--- trunk/spambayes/spambayes/classifier.py     2007-10-22 02:42:47 UTC (rev 
3165)
+++ trunk/spambayes/spambayes/classifier.py     2007-10-22 02:44:14 UTC (rev 
3166)
@@ -652,17 +652,8 @@
         # XXX becomes valid, for example).
         for name, data in [(self.bad_url_cache_name, self.bad_urls),
                            (self.http_error_cache_name, 
self.http_error_urls),]:
-            # Save to a temp file first, in case something goes wrong.
-            cache = open(name + ".tmp", "w")
-            pickle.dump(data, cache)
-            cache.close()
-            try:
-                os.rename(name + ".tmp", name)
-            except OSError:
-                # Atomic replace isn't possible with win32, so just
-                # remove and rename.
-                os.remove(name)
-                os.rename(name + ".tmp", name)
+            from storage import safe_pickle
+            safe_pickle(name, data)
 
     def slurp(self, proto, url):
         # We generate these tokens:


This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.
_______________________________________________
Spambayes-checkins mailing list
[email protected]
http://mail.python.org/mailman/listinfo/spambayes-checkins

Reply via email to