[Zope3-Users] Anyone had any success with ZCatalog in Zope 3?
Johan Carlsson
johanc at easypublisher.com
Fri Nov 18 05:58:20 EST 2005
Hi again,
The ComponentLookupError have re appeared!
> Error type: zope.component.interfaces.ComponentLookupError
> Error object: (<InterfaceClass zope.app.intid.interfaces.IIntIds>, '')
What happend was that I had a IntId utitlity in the root site (renamed
to '') that answered the request when I added the Indexes in a sub site.
So the question is how do I rename the IntId utility programmatically
or why doesn't the following code ad a utility (maybe it's not
registered correctly to be use right after it's been added but needs
some events to trigger first???
First I do this:
intids = IntIds()
tools['intid'] = intids
#I thought this was equal to rename the intid-util to ''!?
intids_reg = UtilityRegistration('', IIntIds, intids)
rm.addRegistration(intids_reg)
intids_reg.status = ActiveStatus
Right after that I do this:
catalog = Catalog()
for index_name, index_attribute, idx_if, attr_call, index_type
in indexes:
idx = index_type(index_attribute, idx_if, attr_call)
catalog[index_name] = idx
tools['catalog'] = catalog
catalog_reg = UtilityRegistration('catalog', ICatalog, catalog)
rm.addRegistration(catalog_reg)
catalog_reg.status = ActiveStatus
This is all called from an event handler, like Dominik pointed out I
should do it.
--
Johan Carlsson Tel: + 46 8 31 24 94
Colliberty Mob: + 46 70 558 25 24
Torsgatan 72 Email: johanc at easypublisher.com
SE-113 37 STOCKHOLM
More information about the Zope3-users
mailing list