I think I've come across a bug, but it could be the way I've overridded
an attribute.
Here's the class (minus join and table name declarations):
class RequestData(SQLObject):
_columns = [
IntCol("requestId", foreignKey="Request", notNone=True),
IntCol("fieldId", foreignKey="Field", notNone=True),
StringCol("value", default=None)]
def _get_value(self):
val = self._SO_get_value()
return cvtGet[self.field.dataType](val)
def _set_value(self, val):
try:
val = cvtSet[self.field.dataType](val)
except:
raise
self._SO_set_value(val)
Here's what happens:
>>> r = RequestData.new(requestId=2006, fieldId=500)
Traceback (most recent call last):
File "<stdin>", line 1, in ?
File "/usr/lib/python2.2/site-packages/SQLObject/SQLObject.py", line
797, in new
setattr(inst, name, value)
File "/home/elian/mefa/Contexts/FDS/Lib/FdsApi.py", line 209, in
_set_value
val = cvtSet[self.field.dataType](val)
File "<string>", line 1, in <lambda>
AttributeError: 'RequestData' object has no attribute '_SO_val_fieldId'
I'm mystified as to why SQLObject is trying to run the _set_value()
method on fieldId...
...Edmund.
|