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

Zope-Dev maillist  -  [EMAIL PROTECTED]
**  No cross posts or HTML encoding!  **
(Related lists - )

Reply via email to