Proposal: Eliminating Globals as an import façade
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 I have just checked in work on a separate branch which removes all use of 'Globals' as an indirection for imports within the Zope2 core, restoring the module to its original purpose, which was to hold shared data (e.g., the opened database, etc.). My rationale was that the current usage leads to a confusion of the actual dependencies, as well as oddball anti-patterns based around import cycles, etc. I got started on the task while trying to track down whatever import-time side effect it is which causes the current functional test failures on the trunk. I didn't actually *find* that issue, of course ;(, but I did get back to the staus quo ante. I am more comfortable now that finding those side-effects will be possible. I do restore the importable names in the module for benefit of 3rd party code, but that happens only at Zope2 startup time (for now). I would prefer that folks change that code, but want to leave such products workable indefinitely: at the moment, for instance, the CMF produccts work at appserver startup, although their tests fail (because the BBB is added too late). The branch is here: svn+ssh://svn.zope.org/repos/main/Zope/branches/tseaver-no_globals_imports I would like to merge the branch soon, because it touches lots of files and is likely to hit conflicts if I let it go too long. I am still pondering whether to have the BBB imports done earlier: I really don't want to spew warnings about them, which is why I didn't use the "deferred import" mechanism initially. Thoughts? Tres. - -- =================================================================== Tres Seaver +1 540-429-0999 tseaver@palladion.com Palladion Software "Excellence by Design" http://palladion.com -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.6 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iD8DBQFJVmF++gerLs4ltQ4RAlWXAKCi4QDmGsXNG0mVz09DUpCGF2Z9rQCgkcKc 8z9rLwRRaKljOGyXiQTbYdg= =0oTI -----END PGP SIGNATURE-----
Tres Seaver wrote:
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1
I have just checked in work on a separate branch which removes all use of 'Globals' as an indirection for imports within the Zope2 core, restoring the module to its original purpose, which was to hold shared data (e.g., the opened database, etc.).
+1 Martin -- Author of `Professional Plone Development`, a book for developers who want to work with Plone. See http://martinaspeli.net/plone-book
Tres Seaver wrote:
svn+ssh://svn.zope.org/repos/main/Zope/branches/tseaver-no_globals_imports
I would like to merge the branch soon, because it touches lots of files and is likely to hit conflicts if I let it go too long.
+1 One tiny suggestion: Wouldn't it be better to add an alias in App.class_init instead of using "from App.class_init import default__class_init__ as InitializeClass" everywhere? Cheers, Yuppie
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 yuppie wrote:
Tres Seaver wrote:
svn+ssh://svn.zope.org/repos/main/Zope/branches/tseaver-no_globals_imports
I would like to merge the branch soon, because it touches lots of files and is likely to hit conflicts if I let it go too long.
+1
One tiny suggestion: Wouldn't it be better to add an alias in App.class_init instead of using "from App.class_init import default__class_init__ as InitializeClass" everywhere?
Yes, likely so. I will do that before merging the branch. Tres. - -- =================================================================== Tres Seaver +1 540-429-0999 tseaver@palladion.com Palladion Software "Excellence by Design" http://palladion.com -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.6 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iD8DBQFJWQWN+gerLs4ltQ4RAmsJAKCry8TJmgvFYekoTdmaqTWAaqyQNQCeMNFR K/rU3IuHPB2BTrmwsbqOSBg= =HuKa -----END PGP SIGNATURE-----
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Tres Seaver wrote:
yuppie wrote:
Tres Seaver wrote:
svn+ssh://svn.zope.org/repos/main/Zope/branches/tseaver-no_globals_imports
I would like to merge the branch soon, because it touches lots of files and is likely to hit conflicts if I let it go too long. +1
One tiny suggestion: Wouldn't it be better to add an alias in App.class_init instead of using "from App.class_init import default__class_init__ as InitializeClass" everywhere?
Yes, likely so. I will do that before merging the branch.
Now done. I plan to merge this branch to the trunk this evening. Tres. - -- =================================================================== Tres Seaver +1 540-429-0999 tseaver@palladion.com Palladion Software "Excellence by Design" http://palladion.com -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.6 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iD8DBQFJWS6n+gerLs4ltQ4RAvvCAKDJdbUKGaolqlu1EKt/Bwq7G+4XogCgkV+3 Zrwi+x0bhTy2wS36GshFAic= =c4dE -----END PGP SIGNATURE-----
participants (3)
-
Martin Aspeli -
Tres Seaver -
yuppie