[Zope-Coders] Re: [Zope-Checkins] CVS:
Zope/lib/python/Products/PluginIndexes/DateRangeIndex -
DateRangeIndex.py:1.6.2.2
Chris McDonough
chrism at plope.com
Tue Nov 4 09:13:09 EST 2003
On Tue, 2003-11-04 at 08:36, Tres Seaver wrote:
> Hmm, I don't see how we can satisfy these competing goals:
>
> - Trying to index an object with invalid target value(s) for a given
> index must allow other indexing to occur; hence, the index may not
> raise an exception;
>
> - Users should not be surprised at being unable to find such objects.
We can satisfy it by using an OOBTree or a different date conversion
algorithm, I guess. But either way, it's a change that would impact
existing sites if there were no data conversion done.
> It seems to me to be either an application error or a configuration
> error to catalog such an object at all: the remedy is either to remove
> the index, or repair the object.
I totally agree with bubbling up an error to the end user when the app
programmer makes an error in typing, but in this case, it's broken not
because the application programmer made an error, it's broken because
the system programmer did. The date is a valid date. That said, I see
your point, but I think trying to paper over it in any of the ways we've
come up with so far is pretty bad.
But while I think it's evil to hide the problem, it seems even more evil
to hose the application programmer entirely by allowing the system to go
totally tits up when a user puts in 9999 as the year or because (as was
the case where I found it), its trying to catalog a default dublin core
CEILING_DATE.
Hmm. The CEILING_DATE thing is really where the problem will occur 99%
of the time, maybe we could just change that to Y2038 and allow the
index to continue to throw the error?
> I guess the choice here should really
> be the applications (in this case, the catalog); the index should
> probably raise the exception, but then have the catalog drop it on the
> floor, if appropriate. We could then add a configuration option to the
> catalog to enable "strict" indexing, if so desired
Maybe the CEILING_DATE workaround would be better until we fix the index
and write the necessary conversion code?
> BTW,what does a text index do if asked to index a non-StringTypes value?
Good point. It appears to make no concession, which is fine, but the
failure cases aren't equivalent for the reasons I mentioned above.
- C
More information about the Zope-Coders
mailing list