[Zope-CVS] CVS: Products/Basket - component.xml:1.1 README.txt:1.6
__init__.py:1.24 basket.py:1.5 resource.py:1.5
Chris McDonough
chrism at plope.com
Fri Nov 11 15:50:30 EST 2005
Update of /cvs-repository/Products/Basket
In directory cvs.zope.org:/tmp/cvs-serv13500
Modified Files:
README.txt __init__.py basket.py resource.py
Added Files:
component.xml
Log Message:
Always preinitialize at import time. This prevents objects in the root folder from showing up as broken if they're loaded from eggs.
Allow people to do %import Products.Basket in their zope.conf to provide the oppportunity to initialize even earlier.
Do a bit of shuffling of import orders.
=== Added File Products/Basket/component.xml ===
<component>
<!-- this actually does nothing -->
</component>
=== Products/Basket/README.txt 1.5 => 1.6 ===
--- Products/Basket/README.txt:1.5 Thu Nov 10 14:44:00 2005
+++ Products/Basket/README.txt Fri Nov 11 15:50:29 2005
@@ -309,6 +309,18 @@
documentation":http://peak.telecommunity.com/DevCenter/setuptools
for more information.
+Broken Objects
+
+ If objects in your root folder show up as "Broken" that are
+ instances of classes which are defined in an egg, put the following
+ statement in your instance's etc/zope.conf file::
+
+ %import Products.Basket
+
+ This causes the Basket product to "pre-initialize" much earlier than
+ it would have otherwise done so, hopefully preventing the machinery
+ which marks things as broken from doing so for egg-based objects.
+
Forward Compatibility Notices
Basket ships with a Python 2.3-compatible version of setuptools'
=== Products/Basket/__init__.py 1.23 => 1.24 ===
--- Products/Basket/__init__.py:1.23 Thu Nov 10 13:21:28 2005
+++ Products/Basket/__init__.py Fri Nov 11 15:50:29 2005
@@ -1,4 +1,5 @@
import sys
+import Globals # this has side effects that require it to be imported early
# pkg_resource monkeypatching (if necessary) needs to happen before
# Products.Basket.utils is imported
@@ -11,16 +12,10 @@
import pkg_resources_0_6a7 as pkg_resources
sys.modules['pkg_resources'] = pkg_resources
-from Products.Basket.basket import Basket
-
-basket = Basket()
-initialize = basket.initialize
-
# Poke the resource classes into the Zope package tree where they will
# wind up in a future zope version, maybe
import resource
-import Globals
Globals.ImageResource = resource.ImageResource
Globals.DTMLResource = resource.DTMLResource
@@ -31,3 +26,10 @@
del resource.ImageResource
del resource.DTMLResource
del resource.PageTemplateResource
+
+from Products.Basket.basket import Basket
+
+the_basket = Basket()
+the_basket.preinitialize()
+initialize = the_basket.initialize
+
=== Products/Basket/basket.py 1.4 => 1.5 ===
--- Products/Basket/basket.py:1.4 Thu Nov 10 17:50:49 2005
+++ Products/Basket/basket.py Fri Nov 11 15:50:29 2005
@@ -8,10 +8,10 @@
import unzip
import zLOG
-from App.config import getConfiguration
-from utils import EggProductContext
from utils import EggProduct
+from utils import EggProductContext
+from App.config import getConfiguration
import pkg_resources
@@ -197,5 +197,4 @@
working_set.entries.remove(distribution.location)
del working_set.by_key[distribution.key]
working_set.entry_keys[distribution.location] = []
- self.old_callbacks = self.working_set.callbacks[:]
sys.path.remove(distribution.location)
=== Products/Basket/resource.py 1.4 => 1.5 ===
--- Products/Basket/resource.py:1.4 Wed Nov 9 16:43:28 2005
+++ Products/Basket/resource.py Fri Nov 11 15:50:29 2005
@@ -4,6 +4,7 @@
import re
import sys
+import Globals
from App.ImageFile import ImageFile, guess_content_type
from App.Common import rfc1123_date
from App.special_dtml import DTMLFile, defaultBindings
@@ -191,7 +192,7 @@
return data
def _cook_check(self):
- if Globals.DevelopmentMode and not self.zipped:
+ if DevelopmentMode and not self.zipped:
__traceback_info__ = str(self.raw)
package, path = self.raw
f = pkg_resources.resource_stream(package, path)
@@ -208,14 +209,6 @@
self.cook()
if not changed:
self.__changed__(0)
-
-# Poke these objects into the Zope package tree where they will wind up in a
-# future zope version
-
-import Globals
-Globals.ImageResource = ImageResource
-Globals.DTMLResource = DTMLResource
-
def is_zipped(package_name):
"""Return true if the given named package is zipped, false if it is a
More information about the Zope-CVS
mailing list