Re: [Zope-CMF] GenericSetup global registries

2011-03-09 Thread Laurence Rowe
On 8 March 2011 16:26, Wichert Akkerman wich...@wiggy.net 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@zope.org
https://mail.zope.org/mailman/listinfo/zope-cmf

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


Re: [Zope-CMF] GenericSetup global registries

2011-03-09 Thread Wichert Akkerman
On 3/9/11 14:41 , Laurence Rowe wrote:
 On 8 March 2011 16:26, Wichert Akkermanwich...@wiggy.net  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@zope.org
https://mail.zope.org/mailman/listinfo/zope-cmf

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


Re: [Zope-CMF] GenericSetup global registries

2011-03-09 Thread Hanno Schlichting
On Wed, Mar 9, 2011 at 3:00 PM, Wichert Akkerman wich...@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.

Hanno
___
Zope-CMF maillist  -  Zope-CMF@zope.org
https://mail.zope.org/mailman/listinfo/zope-cmf

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


Re: [Zope-CMF] GenericSetup global registries

2011-03-09 Thread Godefroid Chapelle
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@zope.org
https://mail.zope.org/mailman/listinfo/zope-cmf

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


Re: [Zope-CMF] GenericSetup global registries

2011-03-09 Thread Martin Aspeli
On 9 March 2011 14:09, Wichert Akkerman wich...@wiggy.net wrote:
 On 3/9/11 15:03 , Hanno Schlichting wrote:
 On Wed, Mar 9, 2011 at 3:00 PM, Wichert Akkermanwich...@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
___
Zope-CMF maillist  -  Zope-CMF@zope.org
https://mail.zope.org/mailman/listinfo/zope-cmf

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


[Zope-CMF] GenericSetup global registries

2011-03-08 Thread Godefroid Chapelle
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-utilitiesold=120672new_path=%2FProducts.GenericSetup%2Fbranches%2Fgotcha-registries-use-utilitiesnew=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@zope.org
https://mail.zope.org/mailman/listinfo/zope-cmf

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


Re: [Zope-CMF] GenericSetup global registries

2011-03-08 Thread Godefroid Chapelle
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@zope.org
https://mail.zope.org/mailman/listinfo/zope-cmf

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