Login | Register For Free | Help
Search for: (Advanced)

Mailing List Archive: Zope: CMF

GenericSetup global registries

 

 

Zope cmf RSS feed   Index | Next | Previous | View Threaded


gotcha at bubblenet

Mar 8, 2011, 8:08 AM

Post #1 of 10 (915 views)
Permalink
GenericSetup global registries

Hello,

GenericSetup has global registries for profiles and steps.

They are a PITA when testing.

For instance, plone.app.testing has to make a complicated dance to
record and restore their state.

In branch gotcha-registries-use-utilities, I have removed those global
storages.

The profiles and steps are instead registered as global named utilities.

All tests pass.

I would appreciate review :

http://zope3.pov.lt/trac/changeset?old_path=%2FProducts.GenericSetup%2Fbranches%2Fgotcha-registries-use-utilities&old=120672&new_path=%2FProducts.GenericSetup%2Fbranches%2Fgotcha-registries-use-utilities&new=120738

If I get no comment within 1 week, I'll assume I can merge and will do so.

TIA ;-)
--
Godefroid Chapelle (aka __gotcha) http://bubblenet.be

_______________________________________________
Zope-CMF maillist - Zope-CMF [at] zope
https://mail.zope.org/mailman/listinfo/zope-cmf

See https://bugs.launchpad.net/zope-cmf/ for bug reports and feature requests


wichert at wiggy

Mar 8, 2011, 8:26 AM

Post #2 of 10 (868 views)
Permalink
Re: GenericSetup global registries [In reply to]

On 2011-3-8 17:08, Godefroid Chapelle wrote:
> Hello,
>
> GenericSetup has global registries for profiles and steps.
>
> They are a PITA when testing.
>
> For instance, plone.app.testing has to make a complicated dance to
> record and restore their state.

How come? There is a very simple cleanup function for them iirc?

> In branch gotcha-registries-use-utilities, I have removed those global
> storages.
>
> The profiles and steps are instead registered as global named utilities.

I'm not convinced using the ZCA makes sense for this. The steps are a
simple list of hooks indexed by name, and the ZCA is massive overkill
for that purpose and very painful to introspect.

Wichert.

--
Wichert Akkerman <wichert [at] wiggy> It is simple to make things.
http://www.wiggy.net/ It is hard to make things simple.
_______________________________________________
Zope-CMF maillist - Zope-CMF [at] zope
https://mail.zope.org/mailman/listinfo/zope-cmf

See https://bugs.launchpad.net/zope-cmf/ for bug reports and feature requests


gotcha at bubblenet

Mar 8, 2011, 8:43 AM

Post #3 of 10 (871 views)
Permalink
Re: GenericSetup global registries [In reply to]

Le 08/03/11 17:26, Wichert Akkerman a écrit :
> On 2011-3-8 17:08, Godefroid Chapelle wrote:
>> > Hello,
>> >
>> > GenericSetup has global registries for profiles and steps.
>> >
>> > They are a PITA when testing.
>> >
>> > For instance, plone.app.testing has to make a complicated dance to
>> > record and restore their state.
> How come? There is a very simple cleanup function for them iirc?

zope.testing.cleanup functions are all or nothing; there are no ways to
clear a part of what was loaded through ZCML.

plone.testing zca.py uses component registry chaining to enable partial
unload of components registrations.

--
Godefroid Chapelle (aka __gotcha) http://bubblenet.be

_______________________________________________
Zope-CMF maillist - Zope-CMF [at] zope
https://mail.zope.org/mailman/listinfo/zope-cmf

See https://bugs.launchpad.net/zope-cmf/ for bug reports and feature requests


wichert at wiggy

Mar 8, 2011, 1:01 PM

Post #4 of 10 (866 views)
Permalink
Re: GenericSetup global registries [In reply to]

On 2011-3-8 17:43, Godefroid Chapelle wrote:
> Le 08/03/11 17:26, Wichert Akkerman a écrit :
>> On 2011-3-8 17:08, Godefroid Chapelle wrote:
>>>> Hello,
>>>>
>>>> GenericSetup has global registries for profiles and steps.
>>>>
>>>> They are a PITA when testing.
>>>>
>>>> For instance, plone.app.testing has to make a complicated dance to
>>>> record and restore their state.
>> How come? There is a very simple cleanup function for them iirc?
>
> zope.testing.cleanup functions are all or nothing; there are no ways to
> clear a part of what was loaded through ZCML.
> plone.testing zca.py uses component registry chaining to enable partial
> unload of components registrations.

And you could extend it to snapshot GS profiles. Lack of support in
plone.testing to do that is not a good reason for complicating GS and
making it harder to debug imho.

Wichert.


--
Wichert Akkerman <wichert [at] wiggy> It is simple to make things.
http://www.wiggy.net/ It is hard to make things simple.

_______________________________________________
Zope-CMF maillist - Zope-CMF [at] zope
https://mail.zope.org/mailman/listinfo/zope-cmf

See https://bugs.launchpad.net/zope-cmf/ for bug reports and feature requests


l at lrowe

Mar 9, 2011, 5:41 AM

Post #5 of 10 (868 views)
Permalink
Re: GenericSetup global registries [In reply to]

On 8 March 2011 16:26, Wichert Akkerman <wichert [at] wiggy> wrote:
> On 2011-3-8 17:08, Godefroid Chapelle wrote:
>> Hello,
>>
>> GenericSetup has global registries for profiles and steps.
>>
>> They are a PITA when testing.
>>
>> For instance, plone.app.testing has to make a complicated dance to
>> record and restore their state.
>
> How come? There is a very simple cleanup function for them iirc?
>
>> In branch gotcha-registries-use-utilities, I have removed those global
>> storages.
>>
>> The profiles and steps are instead registered as global named utilities.
>
> I'm not convinced using the ZCA makes sense for this. The steps are a
> simple list of hooks indexed by name, and the ZCA is massive overkill
> for that purpose and very painful to introspect.

While the ZCA registry may be overkill for a particular case in
isolation, when Zope is taken as a whole it is simpler to deal with
one registry implementation than many differing ones. So +1 for moving
this to the global ZCA registry.

Laurence
_______________________________________________
Zope-CMF maillist - Zope-CMF [at] zope
https://mail.zope.org/mailman/listinfo/zope-cmf

See https://bugs.launchpad.net/zope-cmf/ for bug reports and feature requests


wichert at wiggy

Mar 9, 2011, 6:00 AM

Post #6 of 10 (860 views)
Permalink
Re: GenericSetup global registries [In reply to]

On 3/9/11 14:41 , Laurence Rowe wrote:
> On 8 March 2011 16:26, Wichert Akkerman<wichert [at] wiggy> wrote:
>> On 2011-3-8 17:08, Godefroid Chapelle wrote:
>>> Hello,
>>>
>>> GenericSetup has global registries for profiles and steps.
>>>
>>> They are a PITA when testing.
>>>
>>> For instance, plone.app.testing has to make a complicated dance to
>>> record and restore their state.
>>
>> How come? There is a very simple cleanup function for them iirc?
>>
>>> In branch gotcha-registries-use-utilities, I have removed those global
>>> storages.
>>>
>>> The profiles and steps are instead registered as global named utilities.
>>
>> I'm not convinced using the ZCA makes sense for this. The steps are a
>> simple list of hooks indexed by name, and the ZCA is massive overkill
>> for that purpose and very painful to introspect.
>
> While the ZCA registry may be overkill for a particular case in
> isolation, when Zope is taken as a whole it is simpler to deal with
> one registry implementation than many differing ones. So +1 for moving
> this to the global ZCA registry.

You really want to use the ZCA for every occurance of a string->object
mapping? Really?

Wichert.
_______________________________________________
Zope-CMF maillist - Zope-CMF [at] zope
https://mail.zope.org/mailman/listinfo/zope-cmf

See https://bugs.launchpad.net/zope-cmf/ for bug reports and feature requests


hanno at hannosch

Mar 9, 2011, 6:03 AM

Post #7 of 10 (862 views)
Permalink
Re: GenericSetup global registries [In reply to]

On Wed, Mar 9, 2011 at 3:00 PM, Wichert Akkerman <wichert [at] wiggy> 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.

Hanno
_______________________________________________
Zope-CMF maillist - Zope-CMF [at] zope
https://mail.zope.org/mailman/listinfo/zope-cmf

See https://bugs.launchpad.net/zope-cmf/ for bug reports and feature requests


wichert at wiggy

Mar 9, 2011, 6:09 AM

Post #8 of 10 (865 views)
Permalink
Re: GenericSetup global registries [In reply to]

On 3/9/11 15:03 , Hanno Schlichting wrote:
> On Wed, Mar 9, 2011 at 3:00 PM, Wichert Akkerman<wichert [at] wiggy> 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.

Wichert.
_______________________________________________
Zope-CMF maillist - Zope-CMF [at] zope
https://mail.zope.org/mailman/listinfo/zope-cmf

See https://bugs.launchpad.net/zope-cmf/ for bug reports and feature requests


gotcha at bubblenet

Mar 9, 2011, 6:39 AM

Post #9 of 10 (859 views)
Permalink
Re: GenericSetup global registries [In reply to]

Le 09/03/11 15:09, Wichert Akkerman a écrit :
> 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.
>
> Wichert.

The change I made is internal implementation only.

IOW, it can go into a new 1.6.x GenericSetup release...

... which next Plone 4.0.x and 4.1 can both use (AFAIK they use the same
version of GenericSetup).

This way, plone.testing (which is still not final) can be cleaned up.

--
Godefroid Chapelle (aka __gotcha) http://bubblenet.be

_______________________________________________
Zope-CMF maillist - Zope-CMF [at] zope
https://mail.zope.org/mailman/listinfo/zope-cmf

See https://bugs.launchpad.net/zope-cmf/ for bug reports and feature requests


optilude+lists at gmail

Mar 9, 2011, 7:29 AM

Post #10 of 10 (861 views)
Permalink
Re: GenericSetup global registries [In reply to]

On 9 March 2011 14:09, Wichert Akkerman <wichert [at] wiggy> wrote:
> On 3/9/11 15:03 , Hanno Schlichting wrote:
>> On Wed, Mar 9, 2011 at 3:00 PM, Wichert Akkerman<wichert [at] wiggy>  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
_______________________________________________
Zope-CMF maillist - Zope-CMF [at] zope
https://mail.zope.org/mailman/listinfo/zope-cmf

See https://bugs.launchpad.net/zope-cmf/ for bug reports and feature requests

Zope cmf RSS feed   Index | Next | Previous | View Threaded
 
 


Interested in having your list archived? Contact Gossamer Threads
 
  Web Applications & Managed Hosting Powered by Gossamer Threads Inc.