Diff for "ZopeInLaunchpad/NoteOnZCML"

Not logged in - Log In / Register

Differences between revisions 1 and 2
Revision 1 as of 2010-09-14 09:58:29
Size: 1424
Editor: allenap
Comment:
Revision 2 as of 2010-09-14 09:58:52
Size: 1425
Editor: allenap
Comment:
Deletions are marked like this. Additions are marked like this.
Line 3: Line 3:
{{{  {{{

Michael Hudson clarified some ZCA confusion (where some adapters were not working despite being registered with both the global site manager and via ZCML) with the following message:

  • This may not be news to anyone, but as far as I can see hasn't been
    mentioned explicitly: the adaptor registrations in the ZCML take
    effect when you (a) set up the FunctionalLayer (b) call
    execute_zcml_for_scripts() (c) during appserver startup somehow.  So
    if you only put the registrations in the ZCML and then run tests that
    use cachedproperty but aren't in any layer -- and I bet we do this a
    bit -- they will blow up.
    
    AIUI, setting up the FunctionalLayer *replaces* the global site
    manager, so if you just do the registration at import time, any tests
    that use cachedproperty inside the FunctionalLayer -- and there are
    certainly a lot of these! -- will fail.
    
    If you do both, I don't know offhand why some tests would still fail.
    Maybe some tests have overzealous tearDowns that rip out all adapter
    registrations.
    
    But I would say this: do adapter registrations in ZCML.  If you want
    to use adaptation in cachedproperty, this means all tests using
    cachedproperty need to be in the FunctionalLayer.  If this is too
    onerous, then don't use adaptation in cachedproperty.

The complete thread.

ZopeInLaunchpad/NoteOnZCML (last edited 2010-09-14 09:58:52 by allenap)