[Zope-CMF] Re: [dev] five.localsitemanager: proposal

Hanno Schlichting plone at hannosch.info
Sun Jun 24 18:32:54 EDT 2007


Hanno Schlichting wrote:
>>> ToDo:
>>> -----
>>>
>>> - real world testing
> 
> My testing of Plone 3.0 after the merge so far results in all
> integration tests failing with that stupid error inside the component
> registry when it throws an AttributeError on 'adapters'. The error
> happened a few times already, but I'm too tired to figure out right now
> why it is failing this time.

I looked a bit deeper into this and still cannot figure out what exactly
is going wrong.

Starting any Plone tests will give an AttributeError on self.adapters in
the subscribers method of zope.component.registry.

The registry is actually the one from five.lsm and is found via the
zope.app.component.hooks.SiteInfo container. In there it is available as
the sm property, but it indeed at that point lacks the adapters
attribute. It looks like _init_registries is never called. But when I
overwrite the set method on SiteInfo every time a new sm is set, it has
the right adapters.

Now the event that is fired is the EndRequestEvent during the late steps
of PloneTestCase's SiteSetup. What I suspect is that the five.lsm is
already partially removed at the point the event is fired and thus does
not have an adapters argument anymore. But my knowledge of the actual
inner workings of the ZODB transaction machinery is very limited.

The code in PloneTestCase.setup.SiteSetup looks like this:

def run(self):
    self.app = self._app()
    try:
        [... does the setup ...]
    finally:
        self._abort()
        self._close()
        self._logout()
        self._placefulTearDown()

The event is fired during self._close() and self._abort essentially does
transaction.abort().

I didn't have time to test this properly but maybe this gives somebody
else an idea who wants to look at it...

Hanno



More information about the Zope-CMF mailing list