Re: [Zope3-Users] Re: generations and utilities

2006-01-31 Thread Gary Poster


On Jan 31, 2006, at 11:48 AM, Paolo Invernizzi wrote:

Do you mean if there's a zope.app.keyreference-configure.zcml in  
the instance/etc?


Yes, it's a standard zope 3.2.0 created instance...


Ah well, sorry.  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.  Beyond that I'd have  
to start digging.


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


[Zope3-Users] Re: generations and utilities

2006-01-31 Thread Paolo Invernizzi

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 

Re: [Zope3-Users] Re: generations and utilities

2006-01-31 Thread Gary Poster


On Jan 31, 2006, at 12:23 PM, Paolo Invernizzi wrote:


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...


Heh, ok, I'll try just one more one-second diagnosis then. ;-)

Are you setting the site?

old_site = zope.app.component.hooks.getSite()
zope.app.component.hooks.setSite(object)
try:
# ...add the utilities and indexes in here...
finally:
zope.app.component.hooks.setSite(old_site)

If that doesn't do it, then we'll see if somebody else can suggest

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