|
From: Marek K. <pyt...@we...> - 2004-04-28 18:26:36
|
On Mon, 26 Apr 2004 10:55:56 -0500
Ian Bicking <ia...@co...> wrote:
>
> This is for lazy loading -- you'll note that SQLiteConnection imports
> sqlite in its __init__.
>
> But you're probably encountering a more mundane problem where you
> aren't giving your SQLObject subclass a _connection object, so the
> connection is simply None.
I've checked out the newest revision (105) and I tried this script:
# SNIP
from sqlobject import *
__connection__ = SQLiteConnection('database.db')
#__connection__ = GadflyConnection('gad.fly.db')
class Person(SQLObject):
_connection = __connection__
firstName = StringCol()
middleInitial = StringCol(length=1, default=None)
lastName = StringCol()
Person.dropTable(ifExists=True)
Person.createTable()
p = Person(firstName="John", lastName="Doe")
print p
print p.firstName
p.middleInitial = 'Q'
print p.middleInitial
p2 = Person.get(1)
print p2
print p is p2
# SNIP
This is a lighter version of simpleperson.py from the examples.
__connection__ points to the SQLite backend.
File "C:\sqlobject\sqlobject\main.py", line 943, in dropTable
if ifExists and not cls._connection.tableExists(cls._table):
AttributeError: 'NoneType' object has no attribute 'tableExists'
The same error happens! My gadfly backend has the same problem, since it
uses 90% of the sqlite code.
Is anybody (more experienced than I) working on the sqlite code?
greets,
Marek
|