I think that I figured out what is happening. this is what I figured out:
(1) zapi.getSizeManager is hooked by zope.app.component.hooks.getSiteManager, which returns siteinfo.sm when 'context' argument is None. (2) so, if I want to use an adapter via getSiteManager(), I have to set "siteinfo" appropriately before using it. (3) but I didn't do that, so I got the global site manager instead. Then, I tried the code looks like below, and it seems worked. ---- class Site(BaseSite): # this method will be called as a subscriber of ObjectAddedEvent def onAfterAdded(self): # set siteinfo from zope.app.component.hooks import setSite, getSite save_site = getSite() setSite(self) # add an index to the catalog # (site-manager/intids/catalog are already added by superclass) default = self.getSiteManager()['default'] catalog = default['Catalog'] catalog['JobTitles'] = FieldIndex(field_name='name',interface=IJobTitle) # add a container which superclass is OrderedContainer. jtf = JobTitleFolder() self[u'a'] = jtf # add some object to be cataloged jtf['P'] = JobTitle('President') jtf['VP'] = JobTitle('Vice President') # resume siteinfo setSite(save_site) ---- I used setSite/getSite pair from zope.app.component.hooks . But I wonder if it is an appropriate solution. It would be very helpful to tell me if there is any bad side effect from setSite/getSite. Regards, Katsutoshi -- Watanabe, Katsutoshi _______________________________________________ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users