Re: [SQLObject] Bug? Spurious connection to postgresql
SQLObject is a Python ORM.
Brought to you by:
ianbicking,
phd
From: Iwan V. <iw...@re...> - 2008-12-13 21:54:39
|
On Sat, 2008-12-13 at 20:39 +0300, Oleg Broytmann wrote: > On Sat, Dec 13, 2008 at 07:26:14PM +0200, Iwan Vosloo wrote: > When the connection calls self.queryOne() - is 'self' the connection or > the transaction? Transaction overrides queryOne method to pass the existing > connection instead of creating a new one, but from you exploration it seems > the overridden method is not called, instead the connection calls original > queryOne and creates a new low-level connection. Self is the connection. What happens is this line (dbconnection.py): 755 attr = getattr(self._dbConnection, attr) is called while self is still the Transaction, for attr 'server_version'. This returns the server_version (bound) method on the connection, and calls that with self == the connection. Inside there is where the self.queryOne is called: 304 server_version = self.queryOne("SELECT version()")[0] Maybe a simple workaround would be to implement a server_version method on the Transaction too? (Or to just set it to a value.) - Iwan |