[Zope-CVS] CVS: Products/Basket - __init__.py:1.12 utils.py:1.9

Chris McDonough chrism at plope.com
Mon Nov 7 22:46:58 EST 2005


Update of /cvs-repository/Products/Basket
In directory cvs.zope.org:/tmp/cvs-serv22908

Modified Files:
	__init__.py utils.py 
Log Message:
First few EggProductContext tests.



=== Products/Basket/__init__.py 1.11 => 1.12 ===
--- Products/Basket/__init__.py:1.11	Mon Nov  7 19:38:31 2005
+++ Products/Basket/__init__.py	Mon Nov  7 22:46:28 2005
@@ -42,23 +42,14 @@
             # somewhere in here.
             # XXX test by creating a broken product and see what happens
             product_pkg = get_containing_package(point.module_name)
-            self.set_module_aliases(product_pkg)
             productname = product_pkg.__name__.split('.')[-1]
-            context = EggProductContext(productname, app, product_pkg)
             initializer = point.load()
+            context = EggProductContext(productname, initializer, app,
+                                        product_pkg)
             # XXX debug mode conditions raise_exc, log_exc
-            returned = context.install(initializer, raise_exc=True,
-                                       log_exc=True)
+            returned = context.install()
             data.append(returned)
         return data
-
-    def set_module_aliases(self, product):
-        if hasattr(product, '__module_aliases__'):
-            for k, v in product.__module_aliases__:
-                if not sys.modules.has_key(k):
-                    if isinstance(v, basestring) and sys.modules.has_key(v):
-                        v = sys.modules[v]
-                    sys.modules[k] = v
 
     def product_distributions_by_dwim(self):
         """ Find all product distributions which have an appropriate


=== Products/Basket/utils.py 1.8 => 1.9 ===
--- Products/Basket/utils.py:1.8	Mon Nov  7 19:38:31 2005
+++ Products/Basket/utils.py	Mon Nov  7 22:46:28 2005
@@ -12,9 +12,11 @@
 from OFS.content_types import guess_content_type
 from App.Common import rfc1123_date
 from App.special_dtml import defaultBindings
+from OFS.misc_ import Misc_
 
 from OFS.Application import pgetattr
 from OFS.Application import get_folder_permissions
+from OFS import Application
 from App.ProductContext import ProductContext
 from App.Product import Product
 from App.Product import ihasattr
@@ -152,8 +154,9 @@
 InitializeClass(EggProduct)
 
 class EggProductContext(object):
-    def __init__(self, productname, app, package):
+    def __init__(self, productname, initializer, app, package):
         self.productname = productname
+        self.initializer = initializer
         self.app = app
         self.package = package
         self.product = self.createProductObject()
@@ -178,7 +181,7 @@
                 fver = pkg_resources.resource_string(packagename, fname)
                 break
 
-        old=None
+        old = None
 
         try:
             if ihasattr(products, productname):
@@ -193,8 +196,9 @@
         except:
             pass
 
-        f=fver and (" (%s)" % fver)
-        product = EggProduct(productname, 'Installed product %s%s' % (productname,f))
+        f = fver and (" (%s)" % fver)
+        product = EggProduct(productname, 'Installed product %s%s' %
+                             (productname, f))
 
         if old is not None:
             app._manage_remove_product_meta_type(product)
@@ -423,7 +427,7 @@
                         v = sys.modules[v]
                     sys.modules[k] = v
 
-    def install(self, initializer, raise_exc=0, log_exc=1):
+    def install(self, raise_exc=0, log_exc=1):
 
         folder_permissions = get_folder_permissions()
 
@@ -436,6 +440,7 @@
         package = self.package
         product = self.product
         productname = self.productname
+        initializer = self.initializer
 
         try:
             # Install items into the misc_ namespace, used by products
@@ -514,9 +519,6 @@
                 raise
 
         return returned
-
-    def initialize_egg_product(self, productp, name, app):
-        pass
 
     def registerHelp(self, *arg, **kw):
         return # this is so not worth it



More information about the Zope-CVS mailing list