[Zope3-Users] Re: generations and utilities

Paolo Invernizzi arathorn at fastwebnet.it
Tue Jan 31 12:23:50 EST 2006


Gary Poster wrote:
> 
> Your recipe looks fine.  If I were in your shoes my 
> next lazy attempt would be to try committing the transaction with the 
> intids and catalog before adding the indexes.

Ok, I added  the transaction... still bangs, the full traceback is at 
the end...
Note that if I don't add Indexes, zope3 starts, full of articles. But 
when I add the index via TTW and reindex, the articles that I added in 
the install.py script aren't indexed (so the IIntIds was not active 
during the install.py), BUT if I add further articles TTW, the added are 
  indexed...

I really donno what/where to dig ;-(


     # 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

     # Commit the transaction before adding the indexes
     transaction.commit()

     catalog['title'] = FieldIndex('title', IArticle)

Traceback (most recent call last):
   File "bin/runzope", line 48, in ?
     run()
   File "bin/runzope", line 44, in run
     main(["-C", CONFIG_FILE] + sys.argv[1:])
   File 
"/Users/arathorn/local/Zope-3_2_0/lib/python/zope/app/twisted/main.py", 
line 74, in main
     service = setup(load_options(args))
   File 
"/Users/arathorn/local/Zope-3_2_0/lib/python/zope/app/twisted/main.py", 
line 143, in setup
     notify(zope.app.appsetup.interfaces.DatabaseOpened(db))
   File 
"/Users/arathorn/local/Zope-3_2_0/lib/python/zope/event/__init__.py", 
line 23, in notify
     subscriber(event)
   File 
"/Users/arathorn/local/Zope-3_2_0/lib/python/zope/app/event/dispatching.py", 
line 66, in dispatch
     for ignored in subscribers(event, None):
   File 
"/Users/arathorn/local/Zope-3_2_0/lib/python/zope/component/__init__.py", 
line 181, in subscribers
     return sitemanager.subscribers(objects, interface)
   File 
"/Users/arathorn/local/Zope-3_2_0/lib/python/zope/component/site.py", 
line 89, in subscribers
     return self.adapters.subscribers(required, provided)
   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/appsetup/bootstrap.py", 
line 151, in bootStrapSubscriber
     zope.event.notify(interfaces.DatabaseOpenedWithRoot(db))
   File 
"/Users/arathorn/local/Zope-3_2_0/lib/python/zope/event/__init__.py", 
line 23, in notify
     subscriber(event)
   File 
"/Users/arathorn/local/Zope-3_2_0/lib/python/zope/app/event/dispatching.py", 
line 66, in dispatch
     for ignored in subscribers(event, None):
   File 
"/Users/arathorn/local/Zope-3_2_0/lib/python/zope/component/__init__.py", 
line 181, in subscribers
     return sitemanager.subscribers(objects, interface)
   File 
"/Users/arathorn/local/Zope-3_2_0/lib/python/zope/component/site.py", 
line 89, in subscribers
     return self.adapters.subscribers(required, provided)
   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/generations/generations.py", 
line 430, in evolveMinimumSubscriber
     evolve(event.database, EVOLVEMINIMUM)
   File 
"/Users/arathorn/local/Zope-3_2_0/lib/python/zope/app/generations/generations.py", 
line 372, in evolve
     manager.install(context)
   File 
"/Users/arathorn/local/Zope-3_2_0/lib/python/zope/app/generations/generations.py", 
line 147, in install
     evolver.evolve(context)
   File 
"/Users/arathorn/sandbox/zope/lib/python/articles/generations/install.py", 
line 74, in evolve
     catalog['title'] = FieldIndex('title', IArticle)
   File 
"/Users/arathorn/local/Zope-3_2_0/lib/python/zope/app/container/sample.py", 
line 86, in __setitem__
     setitem(self, self.__data.__setitem__, key, object)
   File 
"/Users/arathorn/local/Zope-3_2_0/lib/python/zope/app/container/contained.py", 
line 595, in setitem
     notify(event)
   File 
"/Users/arathorn/local/Zope-3_2_0/lib/python/zope/event/__init__.py", 
line 23, in notify
     subscriber(event)
   File 
"/Users/arathorn/local/Zope-3_2_0/lib/python/zope/app/event/dispatching.py", 
line 66, in dispatch
     for ignored in subscribers(event, None):
   File 
"/Users/arathorn/local/Zope-3_2_0/lib/python/zope/component/__init__.py", 
line 181, in subscribers
     return sitemanager.subscribers(objects, interface)
   File 
"/Users/arathorn/local/Zope-3_2_0/lib/python/zope/component/site.py", 
line 89, in subscribers
     return self.adapters.subscribers(required, provided)
   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/event/objectevent.py", 
line 192, in objectEventNotify
     adapters = subscribers((event.object, event), None)
   File 
"/Users/arathorn/local/Zope-3_2_0/lib/python/zope/component/__init__.py", 
line 181, in subscribers
     return sitemanager.subscribers(objects, interface)
   File 
"/Users/arathorn/local/Zope-3_2_0/lib/python/zope/component/site.py", 
line 89, in subscribers
     return self.adapters.subscribers(required, provided)
   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>, '')



More information about the Zope3-users mailing list