Hello,
I've developed a content object for zope and I'm using the install.py
script in a generation package to install some prebuild content
instances in a folder, and everything works well.
I'm now trying to add a Catalog plus IntIds to do some search... but I'm
doing something wrong...
I cannot find the right way to install an IntIds (at least!) in the
global site (I don't care about local sites) and populate the
application via a generation install.py
Must I move the IntIds and Catalog instantiation/registration outside
the script?
def evolve(context):
Install an articles folder full of pre-made articles
root = context.connection.root()
app = root['Application']
# app is a ISite...
assert ISite.providedBy(app)
# get the sitemanager
sitemanager = app.getSiteManager()
default = sitemanager['default']
# add an intids
intids = IntIds()
default['intids'] = intids
intids_reg = UtilityRegistration('', IIntIds, intids)
default.registrationManager.addRegistration(intids_reg)
intids_reg.status = ActiveStatus
# add a catalog
catalog = Catalog()
default['catalog'] = catalog
catalog_reg = UtilityRegistration('', ICatalog, catalog)
default.registrationManager.addRegistration(catalog_reg)
catalog_reg.status = ActiveStatus
# This bangs with
# File
/Users/arathorn/local/Zope-3_2_0/lib/python/zope/interface/adapter.py,
line 481, in subscribers
# subscribers = [subscription(*objects)
# File
/Users/arathorn/local/Zope-3_2_0/lib/python/zope/app/catalog/catalog.py,
line 130, in indexAdded
# index.__parent__.updateIndex(index)
# File
/Users/arathorn/local/Zope-3_2_0/lib/python/zope/app/catalog/catalog.py,
line 68, in updateIndex
# uidutil = zapi.getUtility(IIntIds)
# File
/Users/arathorn/local/Zope-3_2_0/lib/python/zope/component/__init__.py,
line 257, in getUtility
# raise ComponentLookupError(interface, name)
# zope.component.interfaces.ComponentLookupError: (InterfaceClass
zope.app.intid.interfaces.IIntIds, '')
#catalog['title'] = FieldIndex('title', IArticle)
print ===
print Installing prebuild articles...
print ===
app['articles'] = articles = Articles()
... etc etc...
Thanks!
Paolo
___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users