[Zope] case insensitive search?

Robin Becker robin@jessikat.fsnet.co.uk
Wed, 3 Jan 2001 20:32:59 +0000


In article <Pine.LNX.4.21.0101032012320.775-101000@localhost>, Aleksander Salwa
<ololo@zeus.polsl.gliwice.pl> writes
>On Wed, 3 Jan 2001, Robin Becker wrote:
>
>> Is there an easy way to make the Find tab case insensitive. It seems
>> like a very common need, but I see that FindSupport.py is calling
>> string.find which makes it seem as though this is harder than it should
>> be.
>
>Now, I did it better way. No regular expressions. Just case-insensitive
>search. "Case insensitive" checkbox on "Find" form.
>If you need it - just take a look at an attachment.
>Maybe I will send it to the Collector...
>
>
>ololo@zeus.polsl.gliwice.pl, oleks@helper.pl
>
>/--------------------------------------\
>| `long long long' is too long for GCC |
>\--------------------------------------/
>
>[ A MIME APPLICATION / x-gtar part was included here. ]
>
that looks like a nice way to do it, but I reckon we could make the lambda stuff a bit cleverer
ie modify the default find

eg
  if search_caseins:
    FINDER = lambda ob,p=lower(obj_searchterm): find(lower(ob.PrincipiaSearchSource()),p)
  else:
    FINDER = lambda ob,p=obj_searchterm: find(ob.PrincipiaSearchSource(), p)

and then we use

    FINDER(ob)


-- 
Robin Becker