[Zope3-Users] FieldIndex on boolean field - error

FB fbo2 at gmx.net
Wed Mar 28 13:49:01 EDT 2007


Hi,

On Wed, Mar 28, 2007 at 03:55:28PM +0000, Alek Kowalczyk wrote:
> Hi,
> I'm trying to index a boolean field of some object, to simplify retrieving all
> the objects which have some flag turned on.
> 
> I am adding in proper place the index:
> 
> catalog['anomaly'] = FieldIndex('anomaly', IMyObject)
> 
> But then, when I try to get the objects using the following command, I get an
> exception. Is FieldIndex able to index bool field? If not, how to create own
> index for doing that?
> 
> anomalies = catalog.searchResults(anomaly=True)

[snip]

> TypeError: len() of unsized object

A fieldindex always requires a lower and an upper boundary, found objects must
fit into.

Try

 catalog.searchResults(anomaly=(True,True))

BTW: The error is raised because the fieldindex tries to interpret 'True'
as a tuple.

Regards,

Frank


More information about the Zope3-users mailing list