[Zope-dev] (Z)Catalog searches
richard@bizarsoftware.com.au
richard@bizarsoftware.com.au
Fri, 16 Mar 2001 20:41:38 +1100
Casey Duncan wrote:
> 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).
Ack, you're quite right. I completely missed the "if type(vocabulary) is
type(''):" clause. Thanks for pointing that out.
> 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??
Does seem a little odd to me.
> 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)
I used:
my_cat = Catalog()
my_cat.lexicon = GlobbingLexicon()
since the Vocabulary class appears to be a wrapper for the Lexicon allowing
management, and I don't need that. The lexicon now works fine.
Thanks for your help - now to work on the 'or' searching :)
Richard
--
Richard Jones
richard@bizarsoftware.com.au
Senior Software Developer, Bizar Software (www.bizarsoftware.com.au)