Re: [dabo-dev] dabo Commit 4040

Author: johnf

Posted: 2008-04-15 at 20:13:28

Sorry if I had to do something. I have been waiting for you. I still get an

error on the virtual fields for my children.

On Tuesday 15 April 2008 04:53:35 pm 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.

>

> 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

>

>

>

>

>

[excessive quoting removed by server]

©2008 johnf