[Webware-devel] NoneType error in PooledDB.__del__

Top Page
Author: Jehiah Czebotar
Date:  
To: webware-devel
CC: Anderson, Susan C. (SCA)
Subject: [Webware-devel] NoneType error in PooledDB.__del__
The following bug has been noted before, and I'm including a patch for
it that hopefully someone on this list can apply to trunk for me

The Error is as follows, and happens when a script or program is
shutting down when the PooledDB object is getting cleaned up:

Exception exceptions.TypeError: "'NoneType' object is not callable" in
<bound method PooledDB.__del__ of <DBUtils.PooledDB.PooledDB instance
at 0xb6a7166c>> ignored

(previous observances)
        http://www.mail-archive.com/webware-devel@lists.sourceforge.net/msg02612.html
        http://groups.google.co.ve/group/webpy/msg/ed1febae877f6bae

The problem code is in PooledDB:

def __del__(self):
"""Delete the pool."""
        if hasattr(self, '_connections'):
                self.close()

However in my case _connections = 0, so we need to change it to do this:

        def __del__(self):
        """Delete the pool."""
                if hasattr(self, '_connections') and self._connections>0:
                        self.close()

This was observed when using cx_Oracle as the database class but i
don't know that it caused this at all because one of the referenced
observances was against mysql

a patch file against trunk is attached.

(Credit for fixing this goes to Susan Anderson our DBA at work who
tracked down the fix)

--
Jehiah
-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/_______________________________________________
Webware-devel mailing list
Webware-devel@???
https://lists.sourceforge.net/lists/listinfo/webware-devel