SQLite on Windows 2000 using Turbogears 9a4.
O.K. Lets use the "Brian Becks Multiuser Todo List" as a reference.
http://www.turbogears.org/preview/docs/tutorials/todolist/
After installing Turbogears I installed pysqlite on win2k and tested it
directly in python.
from sqlobject import *
import sys, os
connection_string = "sqlite:/:memory:"
connection = connectionForURI(connection_string)
sqlhub.processConnection = connection
class Person(SQLObject):
firstName = StringCol()
middleInitial = StringCol(length=1, default=None)
lastName = StringCol()
Person.createTable()
Person(firstName="John", lastName="Doe")
print Person.get(1)
Output:
<Person 1 firstName='John' middleInitial=None lastName='Doe'>
So far so good!
Now enter the following in all my config files:
sqlobject.dburi="sqlite:///c|/ajax/ajax.db"
Now edit model.py:
from sqlobject import *
from turbogears.database import PackageHub
hub = PackageHub("ajax")
__connection__ = hub
class Genre(SQLObject):
name = StringCol(length=200)
artists = RelatedJoin('Artist')
class Artist(SQLObject):
name = StringCol(length=200)
genres = RelatedJoin('Genre')
albums = MultipleJoin('Album')
class Song(SQLObject):
name = StringCol(length=200)
album = ForeignKey('Album')
class Album(SQLObject):
name = StringCol(length=200)
artist = ForeignKey('Artist')
songs = MultipleJoin('Song')
The result:
C:\ajax>tg-admin sql create
Using database URI sqlite:///c|/ajax/ajax.db
Exception exceptions.AttributeError: "'pysqlite2.dbapi2.Connection'
object has n
o attribute 'autocommit'" in <bound method Transaction.__del__ of
<sqlobject.dbc
onnection.Transaction object at 0x01261CF0>> ignored
The database is created and is empty.
Any Suggestions?
I may get this some day!
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"TurboGears" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/turbogears
-~----------~----~----~----~------~----~------~--~---