Re: [pysqlite] Possible Regression in pysqlite 2.5.3
Gerhard Häring <[email protected]> Tue, 10 Mar 2009 23:41:05 +0100
| Newsgroups | gmane.comp.python.db.pysqlite.user |
|---|---|
| Message-ID | <[email protected]> |
Markus Gritsch wrote:
> Hi,
>
> I am using the latest version of SQLObject (0.10.4) which worked fine
> with pysqlite 2.5.2. When upgrading to pysqlite 2.5.3 the following
> minimal example
>
> from sqlobject import *
> sqlhub.processConnection = connectionForURI('sqlite:/:memory:')
>
> gives this traceback:
>
> Traceback (most recent call last):
> File "sepp.py", line 2, in <module>
> sqlhub.processConnection = connectionForURI('sqlite:/:memory:')
> File "C:\Python25\lib\site-packages\sqlobject-0.10.4-py2.5.egg\sqlobject\dbconnection.py",
> line 934, in connectionForURI
> conn = connCls.connectionFromURI(uri)
> File "C:\Python25\lib\site-packages\sqlobject-0.10.4-py2.5.egg\sqlobject\sqlite\sqliteconnection.py",
> line 104, in connectionFromURI
> return cls(filename=path, **args)
> File "C:\Python25\lib\site-packages\sqlobject-0.10.4-py2.5.egg\sqlobject\sqlite\sqliteconnection.py",
> line 92, in __init__
> self.filename, **self._connOptions)
> pysqlite2.dbapi2.ProgrammingError: Base Connection.__init__ not called.
This is from a new check that was introduced in 2.5.3. Subclassed
connection and cursor classes now verify that their parent __init__
method was called.
<rant mode="on">
I looked into the part of SQLObject that implements the SQLite
connection again. And *again*, 20 minutes of lifetime wasted because of
object-oriented spaghetti code. This asks for throwing it away and
rewriting it from scratch. I promise to not bother with SQLObject again.
Ever.
</rant>
My best guess is that they're subclassing dbapi2.Connection somewhere
for no good reason, but not really using it. And that they're wrapping
the pysqlite connection elsewhere anyway.
Really, just throw it away and rewrite the module from scratch without
pysqlite 0.x/1.x support in a straightforward way.
Or maybe I'm wrong and you encountered a legitimate usage of the
pysqlite API that can lead to this error. But I doubt that until proven
wrong.
-- Gerhard