[SQLObject] Default Behaviour when notNull == False
SQLObject is a Python ORM.
Brought to you by:
ianbicking,
phd
|
From: Brad B. <br...@bb...> - 2003-04-30 13:57:04
|
I have a class:
class MerchantAccount(SQLObject):
_columns = [
StringCol('merchantID', length = 15, alternateID = True, notNull = True),
StringCol('companyName', length = 50, notNull = True),
StringCol('address1', length = 255, notNull = False),
StringCol('address2', length = 255, notNull = False),
IntCol('telephone', notNull = False),
IntCol('fax', notNull = False),
StringCol('url', length = 100, notNull = False),
StringCol('lang', length = 6, notNull = False)
]
MultipleJoin('MerchantProxyAccount')
and then in a nearby piece of code, an insert:
from merchant import MerchantAccount, MerchantProxyAccount, PurchaseTransaction
ma = MerchantAccount.new(merchantID = "foo", companyName = "bar")
When run, this raises an error:
bradb@mothra:~/1ave/merchant/scripts$ python insert_test_data.py
Traceback (most recent call last):
File "insert_test_data.py", line 5, in ?
ma = MerchantAccount.new(merchantID = "desjardins", companyName = "Premiere Avenue")
File "/usr/lib/python2.2/site-packages/SQLObject/SQLObject.py", line 682, in new
raise TypeError, "%s did not get expected keyword argument %s" % (cls.__name__, repr(column.name))
TypeError: MerchantAccount did not get expected keyword argument 'address1'
Can we change the behaviour of this to "feel" more like an SQL insert,
so that if a column's allowed to be null, I don't have to specify it
in the new()?
--
Brad Bollenbach
BBnet.ca
|