[Zope] Re: SortEx module feature request thinking

Peter Bengtsson mail@peterbe.com
Tue, 28 Aug 2001 17:04:39 +0200


>    Well, about your question: instead of predefined 'nocase' you can pass
> your own function (see examples in SortEx tar.gz). And in this function
you
> can do whatever you want - you can determine types of your parameters,
> compare them in any way you prefer, etc. SorEx is a framework you can use
> to simplify your sorting needs!

That's great, and I knew that but I'm lazy.
I thought it could be one of those things that comes with it by default.

Hm. Shame on me for being lazy. Guess I'll try to pass my own function.

Cheers, Peter


> On Tue, 28 Aug 2001, Peter Bengtsson wrote:
> > If you pass an argument to sort on to the SortEx and pass also 'nocase'
it
> > breaks if the thing to sort on cannot be case insensitive.
> >
> > This works:
> >
> > r=SortEx(sequence, ( ( 'companyName' ,  ) , )  )
> > # and this
> > r=SortEx(sequence, ( ( 'companyName' , 'nocase' ) , )  )
> > # and this
> > r=SortEx(sequence, ( ( 'modificationTime' , ) , )  )
> > # But this breaks! of course
> > r=SortEx(sequence, ( ( 'modificationTime' , 'nocase' ) , )  )
> >
> > Sensible.
> >
> > But suppose that one really doesn't know what one is sorting one?
> > * If its a string property, I want it case-insensitive.
> > * If its a date property, don't pass the 'nocase' thing
> >
> > Maybe there is a way to do this, but I don't know how. So how?
> > If there isn't a way to do this, can I suggest a syntax like this:
> >
> > r=SortEx(sequence, ( ( REQUEST.foobar , 'nocase' , 'anyproperty' )
 )  )
> > ...or...
> > r=SortEx(sequence, ( ( REQUEST.foobar , 'nocase_nocomplain' ) , )  )
>
> Oleg.
> ----
>      Oleg Broytmann     http://www.zope.org/Members/phd/     phd@phd.pp.ru
>            Programmers don't die, they just GOSUB without RETURN.
>