Hi guys,
I may have discovered a bug in the dGrid. In the past I never allowed editing of a cell in a grid. Therefore, I've never seen this error. In a current project it makes sense to allow editing in the grid. The cell in question is a float or decimal (postgres datatype = numeric(5,5)) and when the user changes the value I get the following error:

2013-10-05 20:08:42 - ERROR - !!! Data Type Mismatch: table=cs.csreceiptshchg; field=nrate. Expecting: <class 'decimal.Decimal'>; got: <type 'float'>

I traced the error to dGrid -> _setCellValue()
The failure happens because of:

> column.DataType
<class 'decimal.Decimal'>

which is not a string and what I believe the code is looking for with
if isinstance(val, float) and column.DataType == "decimal":

The prevent the error message I did the following:

    def _setCellValue(self, row, col, val):
        try:
            column = self.Columns[col]
            fld = column.DataField
            biz = self.getBizobj()
if isinstance(val, float) and (issubclass(column.DataType, Decimal) or column.DataType == "decimal"):
                 val = Decimal(ustr(val))

But I'm not sure if the real issue isn't deeper. So before I push anything I'd like others to review.

What are your thoughts?

Johnf
_______________________________________________
Post Messages to: Dabo-users@leafe.com
Subscription Maintenance: http://mail.leafe.com/mailman/listinfo/dabo-users
Searchable Archives: http://leafe.com/archives/search/dabo-users
This message: http://leafe.com/archives/byMID/5250e81d.7070...@jfcomputer.com

Reply via email to