[Zope-CMF] GenericSetup global registries

Martin Aspeli optilude+lists at gmail.com
Wed Mar 9 10:29:45 EST 2011


On 9 March 2011 14:09, Wichert Akkerman <wichert at wiggy.net> wrote:
> On 3/9/11 15:03 , Hanno Schlichting wrote:
>> On Wed, Mar 9, 2011 at 3:00 PM, Wichert Akkerman<wichert at wiggy.net>  wrote:
>>> You really want to use the ZCA for every occurance of a string->object
>>> mapping? Really?
>>
>> As long as Zope doesn't have a central configuration registry like
>> Pyramid has, it unfortunately makes sense. It's massive overkill and
>> we shouldn't need to force simple values into interfaces, but that's
>> the current state of things.
>
> It worked fine without using the ZCA before, so I don't really see the
> problem that we're trying to solve here. It all looks like a workaround
> for a missing feature in plone.testing, which won't even help much since
> plone.testing needs to support older GS releases as well.

I think that may be subjective. It worked fine before because no-one
ever put more than one instance of the registry in the same process,
and test isolation with ZopeTestCase/PloneTestCase is a joke, so
people just accepted leaked state.

Global registries maintained in global variables are an anti-pattern,
precisely because they always make testing more difficult. We have a
standard way to do registries (which may be 'overkill' for this use
case in isolation, but not massively so, and as Hanno and Laurence
pointed out, consistency of approach matters too). We should use it.

plone.testing will evolve, and we'll have a policy whereby major
version numbers align with Plone (and thus, indirectly, Zope) versions
so as not to have to laden it with the type of BBB spaghetti that made
PloneTestCase impossible to maintain. I'm all for cleanup.

Next up, get rid of the super-insane global ZCA registry instance
variables (yes, plural). But I digress.

Martin


More information about the Zope-CMF mailing list