El mié, 06-07-2005 a las 19:57 +0200, Antonio Beamud Montero escribió: > Hi all: > In my app, I'm using ZODB to store data, the problem is that I have > implemented several unittest, for every unit test I create the ZODB > database and when the test finished I destroy the database (including > files). When I run 2 test, the first is executed ok, but the second test > give me the next Exception: > > Traceback (most recent call last): > File "./test_collector.py", line 240, in runTest > self.collect = Collector(conf) > File "/usr/lib/python2.3/site-packages/mylib/collector.py", line 78, > in __init__ > get_transaction().commit() > File "/opt/zope/lib/python/ZODB/Transaction.py", line 232, in commit > self._commit_begin(jars, subjars, subtransaction) > File "/opt/zope/lib/python/ZODB/Transaction.py", line 340, in > _commit_begin > jar.tpc_begin(self) > File "/opt/zope/lib/python/ZODB/Connection.py", line 692, in tpc_begin > self._storage.tpc_begin(transaction) > AttributeError: 'NoneType' object has no attribute 'tpc_begin' > > To shutdown the class containing the ZODB connection: > > def shutdown(self): > self.db.close() > self.storage.close() > return > > But, if I execute only the second test, all works ok... > I've try to debug the problem, but the ZODB code is very deep and > complex... >
Sorry, I not give you all the info: To open the database: testdata = '/tmp/zodb.fs' class Collector: def __init__(self, config=None): try: self.storage = FileStorage.FileStorage(testdata, create=1) self.db = DB(self.storage) self.db.setPoolSize(20) zodbcon = self.db.open() root = zodbcon.root() except Exception,e: sys.exit(0) if not root.has_key('pendings'): root['pendings'] = Status('pendings') get_transaction().commit() def shutdown(self): self.db.close() self.storage.close() return The problem arises when the commit() is executed... I have tested ZODB but the problem doesn't raises... Greetings. _______________________________________________ For more information about ZODB, see the ZODB Wiki: http://www.zope.org/Wikis/ZODB/ ZODB-Dev mailing list - ZODB-Dev@zope.org http://mail.zope.org/mailman/listinfo/zodb-dev