[Zope-dev] case insensitive sorts

Andy McKay andym@ActiveState.com
Wed, 6 Dec 2000 12:42:20 -0800


Oh yeah for the ZCatalog I have two indexes one upper case and one lower
case for some of my classes. No problemo. My area to attack though is the
standard views such as the management interface...

How's life in Lancaster? Went to school there and grew up in Garstang....

--
  Andy McKay, Developer.
  ActiveState.

----- Original Message -----
From: "Steve Alexander" <s.alexander@lancaster.ac.uk>
To: "Andy McKay" <andym@activestate.com>
Cc: <zope-dev@zope.org>
Sent: Wednesday, December 06, 2000 11:03 AM
Subject: Re: [Zope-dev] case insensitive sorts


> Andy McKay wrote:
>
> > Minor nit and patch: I've found that really for me what users want to
see is
> > a case insensitive sort of objects, not the current python case
sensitive
> > sort. So that the order of objects from dtml-in and tree is a, A, b, B
as
> > apposed to A, B, a, b.
> >
> > Anyway Ive patched dtml-in and dtml-tree to do this sort on a
ignore_case
> > tag. Is this useful to anyone else? And Ive thought of patching my Zope
so
> > this is the default behaviour.... what does anyone else think. The next
> > thing to patch is ZCatalog...
>
>
> The way I approached this was to have a ZPatterns attribute provider, or
> a method, that provides a modified version of the value I want to sort on.
>
> For example, I have a load of documents and folders with titles like
>
>   Big Folder
>
>   brown document
>
>   "Berries for Cooking" list
>
> I wanted to present these sorted by non-case-sensitive first letter or
> number. So, I made a method "title_for_sorting" that stripped off any
> punctuation at the start, and returned the first 20 characters in all
> lower case.  In this case, as it was a ZPatterns application, the method
> was presented as an attribute of the object using some skin-script. I
> used this attribute as a field-index in my SiteIndex ZCatalog.
>
> The reason I mention this is that sometimes case-insensitivity is not
> enough for sensible sorting. In this case, I had to strip out
> punctuation too.
>
> --
> Steve Alexander
> Software Engineer
> Cat-Box limited
> http://www.cat-box.net
>