On 11.06.2006, at 23:39, Florian Lindner wrote:

Hello,
suddenly I get this error, the code used to work....

File "/home/xgmde/Zope3//lib/python/zope/component/_api.py", line 207, in
getUtility
    raise ComponentLookupError(interface, name)
ComponentLookupError: (<InterfaceClass zope.app.intid.interfaces.IIntIds>, '')

The problem is clear but it should not appear. It occurs upon adding my
object. This object performs some initializations:


def onObjectAdded(event):
    if IXGM.providedBy(event.object):
        if not ISite.providedBy(event.object):
            # Make it a site
            xgm = event.object
            site_manager = LocalSiteManager(xgm)
            xgm.setSiteManager(site_manager)

intid = ensureUtility(xgm, IIntIds, '', IntIds , asObject = True)

cat = ensureUtility(xgm, ICatalog, '', Catalog, asObject = True)

            abbr_index = TextIndex("abbreviation", IAbbreviation)
            cat["AbbreviationIndex"] = abbr_index



i think you have to set the site after you have made your object a site

from zope.app.component import hooks
hooks.setSite(xgm)

Regards, Bernd



When I trace into that I can see that the intid is really created and also at
the correct place.

When I comment the catalog creation out it works and I can add the catalog with the ZMI without any problems. But why does it not find the IntID utility
when created from code?

Anyone knows whats wrong?


Thanks,

Florian
_______________________________________________
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users

_______________________________________________
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users

Reply via email to