[Zope-dev] (Z)Catalog searches

Casey Duncan cduncan@kaivo.com
Thu, 15 Mar 2001 15:09:27 -0700


richard@bizarsoftware.com.au wrote:
> 
> I tried both
> 
>    my_catalog = Catalog(GlobbingLexicon())
> 
> and
> 
>    my_catalog = Catalog(Vocabulary(globbing=1))
> 
> and neither resulted in any calls to any GlobbingLexicon methods!
> 
>      Richard
> 

Catalog doesn't take the Vocabulary object itself as an argument. It
takes the (string) id of an acquirable Vocabulary. If you don't specify
a string, it creates a standard non-globbing lexicon (Although a
ZCatalog creates a globbing lexicon, go figure). Something like this
should work (Assuming your product is an acquisition wrapper e.g. by
subclassing Acquisition.Implicit):

my_vocab = Vocabulary(globbing=1)
my_cat = Catalog(vocabulary='my_vocab')

I'm completely unsure why it was implemented this way. I can kinda
understand for ZCatalog, but not really for Catalog. Anyone care to
explain??

or you could do this without using acquistion, but you wind up creating
the vocabulary twice:

my_cat = Catalog()
my_cat.lexicon = Vocabulary(globbing=1)

-- 
| Casey Duncan
| Kaivo, Inc.
| cduncan@kaivo.com
`------------------>