Commit 5913ce6e authored by Jeremy Hylton's avatar Jeremy Hylton

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.
parent 0c30add2
...@@ -79,12 +79,11 @@ class Draft(Persistent, Implicit, SimpleItem.Item): ...@@ -79,12 +79,11 @@ class Draft(Persistent, Implicit, SimpleItem.Item):
try: db=self._p_jar.db() try: db=self._p_jar.db()
except: except:
# BoboPOS 2 # BoboPOS 2
jar=Globals.VersionBase[self._version].jar jar = Globals.VersionBase[self._version].jar
else: else:
# ZODB 3 # ZODB 3
jar=db.open(self._version) jar = db.open(self._version)
cleanup=Cleanup() cleanup = Cleanup(jar)
cleanup.__del__=jar.close
REQUEST[Cleanup]=cleanup REQUEST[Cleanup]=cleanup
...@@ -159,4 +158,9 @@ def getdraft(ob, jar): ...@@ -159,4 +158,9 @@ def getdraft(ob, jar):
return ob return ob
class Cleanup: pass class Cleanup:
def __init__(self, jar):
self._jar = jar
def __del__(self):
self._jar.close()
...@@ -17,7 +17,7 @@ ...@@ -17,7 +17,7 @@
in favor of a standard xml package once some issues are in favor of a standard xml package once some issues are
worked out.""" worked out."""
__version__='$Revision: 1.14 $'[11:-2] __version__='$Revision: 1.15 $'[11:-2]
import sys, os import sys, os
import Shared.DC.xml.xmllib import Shared.DC.xml.xmllib
...@@ -102,10 +102,6 @@ class Document(Node): ...@@ -102,10 +102,6 @@ class Document(Node):
result.append(node.toxml()) result.append(node.toxml())
return ''.join(result) return ''.join(result)
#def __del__(self):
# self.document=None
# print 'bye!'
class Element(Node): class Element(Node):
__type__=type_element __type__=type_element
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment