[Zodb-checkins] CVS: Zope/lib/python/ZODB - TmpStore.py:1.10 ZApplication.py:1.13 lock_file.py:1.9
Jeremy Hylton
jeremy@zope.com
Tue, 8 Apr 2003 14:48:53 -0400
Update of /cvs-repository/Zope/lib/python/ZODB
In directory cvs.zope.org:/tmp/cvs-serv7036/lib/python/ZODB
Modified Files:
TmpStore.py ZApplication.py lock_file.py
Log Message:
Cleanup __del__.
You never need an __del__ to close a file. A file closes itself when
it is deallocated.
Don't give an object a magic __del__ attribute. It won't work with
new-style classes, and it's obscure anyway.
=== Zope/lib/python/ZODB/TmpStore.py 1.9 => 1.10 ===
--- Zope/lib/python/ZODB/TmpStore.py:1.9 Thu Jan 2 13:05:47 2003
+++ Zope/lib/python/ZODB/TmpStore.py Tue Apr 8 14:48:22 2003
@@ -37,10 +37,6 @@
self._db = None
self._creating = []
- def __del__(self):
- # XXX Is this necessary?
- self._file.close()
-
def close(self):
self._file.close()
=== Zope/lib/python/ZODB/ZApplication.py 1.12 => 1.13 ===
--- Zope/lib/python/ZODB/ZApplication.py:1.12 Fri Jan 17 12:23:14 2003
+++ Zope/lib/python/ZODB/ZApplication.py Tue Apr 8 14:48:22 2003
@@ -52,8 +52,7 @@
hook(conn)
# arrange for the connection to be closed when the request goes away
- cleanup=Cleanup()
- cleanup.__del__=conn.close
+ cleanup = Cleanup(conn)
REQUEST._hold(cleanup)
conn.setDebugInfo(REQUEST.environ, REQUEST.other)
@@ -81,4 +80,9 @@
return connection.root()[aname]
-class Cleanup: pass
+class Cleanup:
+ def __init__(self, jar):
+ self._jar = jar
+
+ def __del__(self):
+ self._jar.close()
=== Zope/lib/python/ZODB/lock_file.py 1.8 => 1.9 ===
--- Zope/lib/python/ZODB/lock_file.py:1.8 Fri Feb 28 14:50:06 2003
+++ Zope/lib/python/ZODB/lock_file.py Tue Apr 8 14:48:22 2003
@@ -69,6 +69,3 @@
self._fp.close()
os.unlink(self._path)
self._fp = None
-
- def __del__(self):
- self.close()