[Zope-Checkins] CVS: Zope/lib/python/Products/OFSP - Draft.py:1.20
Jeremy Hylton
jeremy@zope.com
Tue, 8 Apr 2003 14:48:52 -0400
Update of /cvs-repository/Zope/lib/python/Products/OFSP
In directory cvs.zope.org:/tmp/cvs-serv7036/lib/python/Products/OFSP
Modified Files:
Draft.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/Products/OFSP/Draft.py 1.19 => 1.20 ===
--- Zope/lib/python/Products/OFSP/Draft.py:1.19 Wed Aug 14 18:16:04 2002
+++ Zope/lib/python/Products/OFSP/Draft.py Tue Apr 8 14:48:21 2003
@@ -79,12 +79,11 @@
try: db=self._p_jar.db()
except:
# BoboPOS 2
- jar=Globals.VersionBase[self._version].jar
+ jar = Globals.VersionBase[self._version].jar
else:
# ZODB 3
- jar=db.open(self._version)
- cleanup=Cleanup()
- cleanup.__del__=jar.close
+ jar = db.open(self._version)
+ cleanup = Cleanup(jar)
REQUEST[Cleanup]=cleanup
@@ -159,4 +158,9 @@
return ob
-class Cleanup: pass
+class Cleanup:
+ def __init__(self, jar):
+ self._jar = jar
+
+ def __del__(self):
+ self._jar.close()