Hi all,
I am trying to create tables on the fly and populate them via
dAutoBizobj.initTable.
I cannot figure why this message is produced:
--------------------------------------------------------------------
Traceback (most recent call last):
File "testapp.py", line 32, in ?
main()
File "testapp.py", line 29, in main
dabo.biz.autoCreateTables()
File "c:\dabo\dabo\dabo\biz\dAutoBizobj.py", line 47, in autoCreateTables
biz.CreateTable()
File "c:\dabo\dabo\dabo\biz\dAutoBizobj.py", line 283, in CreateTable
self.new()
File "c:\dabo\dabo\dabo\biz\dBizobj.py", line 615, in new
self._onNew()
File "c:\dabo\dabo\dabo\biz\dBizobj.py", line 941, in _onNew
cursor.setDefaults(self.DefaultValues)
File "c:\dabo\dabo\dabo\db\dCursorMixin.py", line 1124, in setDefaults
raise ValueError, "Can't set default value for nonexistent field '%s'." % kk
ValueError: Can't set default value for nonexistent field 'owing'.
--------------------------------------------------------------------
from this code:
--------------------------------------------------------------------
import dabo
from dabo.db import dTable
import dabo.biz.dAutoBizobj as autobiz
def main():
class Customer(autobiz):
def initProperties(self):
self.DataSource = "customer"
self.KeyField = "id"
self.RequeryOnLoad = False
def getTable(self):
tab = dTable(Name="customer", IsTemp=False)
tab.addField(Name="id", IsPK=True, DataType="int", Size=2,
IsAutoIncrement=True)
tab.addField(Name="code", DataType="int", Size=4,
AllowNulls=False, Index="idx_code")
tab.addField(Name="name", DataType="string", Size=50,
Index="idx_name")
tab.addField(Name="contact", DataType="string", Size=15)
tab.addField(Name="owing", DataType="float", TotalDP=8,
RightDP=2, Size=8, Default=0)
return tab
def initTable(self):
cols = ('code','name','contact','owing')
return (cols, ((1,"Ken's Kayaks","Ken",100.55),(2,"Bob's
Bikes","Bob",234.56)))
ci = dabo.db.dConnectInfo(DbType="SQLite", Database="test.db")
conn = dabo.db.dConnection(ci)
dabo.biz.setupAutoBiz(conn, (Customer,))
dabo.biz.autoCreateTables()
if __name__ == "__main__":
main()
--------------------------------------------------------------------
Any pointers welcome.
Mark Doukidis
_______________________________________________
Post Messages to: [email protected]
Subscription Maintenance: http://leafe.com/mailman/listinfo/dabo-users