johnf wrote:
> Dabo Error Log: Wed Sep 10 07:57:24 2008: !!! Data Type Mismatch: 
> field=cvendor. Expecting: <type 'str'>; got: <type 'unicode'>
> 
> The above error is caused by the following statement in my bizobj class
> 
> self.addField("apvend.cvendno as cvendor")  
> 
> which is required for a join on two tables (apvend and aglots).  Where aglots 
> is the primary.
> 
> And the actual code that prints the error is in dCursorMixin.  So can I fix 
> this? 

You found a bug! See below:

> 
> dCursorMixin code below is what prints the error:
> 
> if fldType != type(val):
>                               ignore = False
>                               # Date and DateTime types are handled as 
> character, even if the
>                               # native field type is not. Ignore these. NOTE: 
> we have to deal with the
>                               # string representation of these classes, as 
> there is no primitive for 
> either
>                               # 'DateTime' or 'Date'.
>                               dtStrings = 
> ("<type 'DateTime'>", "<type 'Date'>", "<type 'datetime.datetime'>")
>                               if str(fldType) in dtStrings and 
> isinstance(val, basestring):
>                                       ignore = True
>                               elif isinstance(fldType, basestring) and 
> isinstance(val, basestring):
>                                       ignore = True

Here, we wanted to ignore the error if both the field type and value are 
base strings (unicode or string types). However, we are incorrectly 
using isinstance() to check the base class of fldType. Change that to:

elif issubclass(fldType, basestring) and isinstance(val, basestring)

and test, and then commit!

Paul


_______________________________________________
Post Messages to: [email protected]
Subscription Maintenance: http://leafe.com/mailman/listinfo/dabo-users
Searchable Archives: http://leafe.com/archives/search/dabo-users
This message: http://leafe.com/archives/byMID/[EMAIL PROTECTED]

Reply via email to