Log message for revision 68339:
  Put in an extra check to handle packages that had namespace packages.

Changed:
  U   Zope/trunk/lib/python/App/Extensions.py
  U   Zope/trunk/lib/python/App/FactoryDispatcher.py

-=-
Modified: Zope/trunk/lib/python/App/Extensions.py
===================================================================
--- Zope/trunk/lib/python/App/Extensions.py     2006-05-29 10:59:28 UTC (rev 
68338)
+++ Zope/trunk/lib/python/App/Extensions.py     2006-05-29 11:28:45 UTC (rev 
68339)
@@ -98,12 +98,16 @@
 
     if result is None:
         try:
-            l = name.find('.')
+            l = name.rfind('.')
             if l > 0:
                 realName = name[l + 1:]
                 toplevel = name[:l]
                 
-                m = __import__(toplevel)
+                pos = toplevel.rfind('.')
+                if pos > -1:
+                    m = __import__(toplevel, globals(), {}, toplevel[pos+1:])
+                else:
+                    m = __import__(toplevel)
         
                 d = os.path.join(m.__path__[0], prefix, realName)
                 

Modified: Zope/trunk/lib/python/App/FactoryDispatcher.py
===================================================================
--- Zope/trunk/lib/python/App/FactoryDispatcher.py      2006-05-29 10:59:28 UTC 
(rev 68338)
+++ Zope/trunk/lib/python/App/FactoryDispatcher.py      2006-05-29 11:28:45 UTC 
(rev 68339)
@@ -40,7 +40,13 @@
         for product_id in products.objectIds():
             product = products[product_id]
             if hasattr(product, 'package_name'):
-                packages[product_id] = __import__(product.package_name)
+                pos = product.package_name.rfind('.')
+                if pos > -1:
+                    packages[product_id] = __import__(product.package_name, 
+                                                      globals(), {}, 
+                                                      
product.package_name[pos+1:])
+                else:
+                    packages[product_id] = __import__(product.package_name)
             elif old_product_packages.has_key(product_id):
                 packages[product_id] = old_product_packages[product_id]
     finally:

_______________________________________________
Zope-Checkins maillist  -  Zope-Checkins@zope.org
http://mail.zope.org/mailman/listinfo/zope-checkins

Reply via email to