[Zope-Coders] Re: [Zope-Checkins] CVS:
Zope/lib/python/Products/PluginIndexes/DateRangeIndex -
DateRangeIndex.py:1.6.2.2
Tres Seaver
tseaver at zope.com
Tue Nov 4 09:42:00 EST 2003
On Tue, 2003-11-04 at 09:13, Chris McDonough wrote:
> 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?
That is pretty funny, given that the DateRangeIndex should make the
whole CEILING_DATE / FLOOR_DATE bullshit unnecessary (we want to be
returning None for those values if we actually use a *real* DRI /
DateIndex): CEILING_DATE actually defeats DRI's handling of "half-open"
and "open" ranges!
>
> > 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.
I don't see why: trying to index an inappropriate value is still the
application programmer's error (in this case, that programmer is *me*,
just in case it looks like I'm passing the buck here).
Tres.
--
===============================================================
Tres Seaver tseaver at zope.com
Zope Corporation "Zope Dealers" http://www.zope.com
More information about the Zope-Coders
mailing list