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

Chris McDonough chrism at plope.com
Mon Nov 7 18:31:52 EST 2005


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

Modified Files:
	__init__.py utils.py 
Log Message:
Test for get_containing_package
Pass in productname to product context instead of divining it inside the context.


=== Products/Basket/__init__.py 1.8 => 1.9 ===
--- Products/Basket/__init__.py:1.8	Mon Nov  7 18:28:28 2005
+++ Products/Basket/__init__.py	Mon Nov  7 18:31:22 2005
@@ -38,9 +38,12 @@
         app = context._ProductContext__app
         meta_types = []
         for point in points:
+            # XXX deal with duplicate product names by raising an exception
+            # somewhere in here.
             package = get_containing_package(point.module_name)
+            productname = package.__name__.split('.')[-1]
+            context = EggProductContext(productname, app, package)
             initialize = point.load()
-            context = EggProductContext(app, package)
             data.append(initialize(context))
         return data
 


=== Products/Basket/utils.py 1.5 => 1.6 ===
--- Products/Basket/utils.py:1.5	Mon Nov  7 18:06:25 2005
+++ Products/Basket/utils.py	Mon Nov  7 18:31:22 2005
@@ -152,7 +152,8 @@
 InitializeClass(EggProduct)
 
 class EggProductContext(object):
-    def __init__(self, app, package):
+    def __init__(self, productname, app, package):
+        self.productname = productname
         self.app = app
         self.package = package
         self.createProductObject()
@@ -164,7 +165,7 @@
         fver = ''
 
         packagename = self.package.__name__
-        productname = packagename.split('.')[-1]
+        productname = self.productname
 
         if hasattr(self.package, '__import_error__'):
             ie = self.package.__import_error__



More information about the Zope-CVS mailing list