Hi friends!
I try to make some usefull thing with SQLObject, but I stick with some
problem. Please, examine the example code I have provide. I got
following error:
Traceback (most recent call last):
File "test.py", line 37, in ?
workoutFinishTime=2)
File "/usr/lib/python2.3/site-packages/sqlobject/main.py", line 1183,
in __init__
self._create(id, **kw)
File "/usr/lib/python2.3/site-packages/sqlobject/main.py", line 1207,
in _create
self.set(**kw)
File "<string>", line 1, in <lambda>
File "/usr/lib/python2.3/site-packages/sqlobject/joins.py", line 131,
in performJoin
inst.id)
AttributeError: 'WorkoutSQL' object has no attribute 'id'
Please, explain me what is my fault?
Thanks in advance!
# -*- coding: utf-8 -*-
from sqlobject import *
class WorkoutSQL(SQLObject):
"""Workouts SQLObject class"""
workoutDate = StringCol()
workoutStartTime = IntCol()
workoutFinishTime = IntCol()
set = MultipleJoin('SetSQL')
class SetSQL(SQLObject):
"""Set SQLObject class"""
workout = ForeignKey('WorkoutSQL')
setTitle = UnicodeCol()
setType = IntCol()
setNum = IntCol()
setReps = IntCol()
setWeight = FloatCol()
herculesDBFile = '/home/bashu/test.db'
if __name__ == '__main__':
connectionString = 'sqlite:' + herculesDBFile
connection = connectionForURI(connectionString)
WorkoutSQL._connection = connection
SetSQL._connection = connection
WorkoutSQL.createTable(ifNotExists=True)
SetSQL.createTable(ifNotExists=True)
workout = WorkoutSQL(workoutDate='12',
workoutStartTime=1,
workoutFinishTime=2)
-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
sqlobject-discuss mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/sqlobject-discuss