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.

def getDataTypeForField(self, fld):
        """Given a field name, returns its Python type, or None if no
        DataStructure information is available.
        """
        if fld in self.VirtualFields:
                return type(self.getFieldVal(fld))
        ds = self.getDataStructure()
        if not ds:
                return None
        try:
                fldInfo = [rec[1] for rec in ds
                                if rec[0] == fld][0]
        except IndexError:
                raise ValueError, _("Field '%s' does not exist in the  
DataStructure") % fld
        return dabo.db.getPythonType(fldInfo)


-- Ed Leafe





_______________________________________________
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]

Reply via email to