Ed Leafe wrote:
> On Apr 15, 2008, at 6:16 PM, Paul McNett wrote:
>
>> Commented out the raising of ValueError in getDataTypeForField(),
>> as I was getting lots of Dabo Error Log entries for virtual fields.
>>
>> This matches the doc which says the function will return None if
>> there isn't any DataStructure information for the field.
>
>
> This was the 'syntax error' that John Fabiani was getting last week.
> I had created a fix and sent it to him, and was waiting for
> confirmation that it solved his problem. I know that the docstring
> said it would return None if the field isn't in the DataStructure, but
> I think that if we can determine the field type, we should return it,
> no?
>
> Here's my fix; try it out on your stuff and let me know if it works
> for you. If it's OK, we can change the docstring to reflect this change.
It results in an error if there aren't any records, and the virtual
field function assumes there is an active record:
Traceback (most recent call last):
File
"//Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/wx-2.8-mac-unicode/wx/_core.py",
line 14364, in <lambda>
lambda event: event.callable(*event.args, **event.kw) )
File "/users/pmcnett/dabo/dabo/ui/uiwx/dGrid.py", line 713, in
_setDataTypeFromDataField
dt = self.Parent.typeFromDataField(fld)
File "/users/pmcnett/dabo/dabo/ui/uiwx/dGrid.py", line 1927, in
typeFromDataField
pyType = biz.getDataTypeForField(df)
File "/users/pmcnett/dabo/dabo/biz/dBizobj.py", line 1447, in
getDataTypeForField
return type(self.getFieldVal(fld))
File "/users/pmcnett/dabo/dabo/biz/dBizobj.py", line 1323, in getFieldVal
ret = cursor.getFieldVal(fld, row,
_rowChangeCallback=changeRowNumCallback)
File "/users/pmcnett/dabo/dabo/db/dCursorMixin.py", line 818, in
getFieldVal
raise dException.NoRecordsException, _("No records in the data set.")
Perhaps we should come up with a way to specify what the return values
are for the virtual fields? Brainstorms:
+ Add virtual fields to DataStructure
- no good, because the appdev will have to remember to maintain
info in more than one place; plus, DataStructure really implies
real data, not virtual data.
+ Add return type information to the VirtualFields dict:
self.VirtualFields = {"number_panels": (self.get_number_panels, int)}
This could be made backwards-compatible by ignoring the lack of a
specified return type.
Paul
_______________________________________________
Post Messages to: [email protected]
Subscription Maintenance: http://leafe.com/mailman/listinfo/dabo-dev
Searchable Archives: http://leafe.com/archives/search/dabo-dev
This message: http://leafe.com/archives/byMID/[EMAIL PROTECTED]