]> granicus.if.org Git - python/commitdiff
Added a 'sync' method to shelve. If the underlying database does not have a sync
authorRoger E. Masse <rmasse@newcnri.cnri.reston.va.us>
Tue, 25 Mar 1997 16:06:03 +0000 (16:06 +0000)
committerRoger E. Masse <rmasse@newcnri.cnri.reston.va.us>
Tue, 25 Mar 1997 16:06:03 +0000 (16:06 +0000)
attribute, this method silently ignores this fact.  The default (bsddb's dbhash) does.

Lib/shelve.py

index b05c627379a71761a6ba6d78df5a86db3650cff6..8f709a233a0c08bfc6718cda9d9621d82393b89c 100644 (file)
@@ -72,6 +72,10 @@ class Shelf:
        def __del__(self):
                self.close()
 
+       def sync(self):
+               if hasattr(self.dict, 'sync'):
+                       self.dict.sync()
+           
 
 class BsdDbShelf(Shelf):
        """Shelf implementation using the "BSD" db interface.