[Zope3-checkins] SVN: Zope3/trunk/src/zope/app/ Broke depencies on zope.app.module.

Jim Fulton jim at zope.com
Tue Jun 14 07:47:39 EDT 2005


Log message for revision 30793:
  Broke depencies on zope.app.module.
  

Changed:
  U   Zope3/trunk/src/zope/app/component/site.py
  D   Zope3/trunk/src/zope/app/introspector/DEPENDENCIES.cfg
  U   Zope3/trunk/src/zope/app/introspector/__init__.py

-=-
Modified: Zope3/trunk/src/zope/app/component/site.py
===================================================================
--- Zope3/trunk/src/zope/app/component/site.py	2005-06-14 10:59:36 UTC (rev 30792)
+++ Zope3/trunk/src/zope/app/component/site.py	2005-06-14 11:47:39 UTC (rev 30793)
@@ -42,6 +42,29 @@
 from zope.app.filerepresentation.interfaces import IDirectoryFactory
 from zope.app.traversing.interfaces import IContainmentRoot
 
+##############################################################################
+# from zope.app.module import resolve
+
+# Break the dependency on zope.app.module.  In the long run,
+# we need to handle this better.  Perhaps througha utility.
+
+## def findModule(name, context=None):
+##     """Find the module matching the provided name."""
+##     module = ZopeModuleRegistry.findModule(name)
+##     return module or sys.modules.get(name)
+
+import sys
+
+def resolve(name, context=None):
+    """Resolve a dotted name to a Python object."""
+    pos = name.rfind('.')
+    mod = sys.modules.get(name[:pos])
+##    mod = findModule(name[:pos], context)
+    return getattr(mod, name[pos+1:], None)
+
+# from zope.app.module import resolve
+##############################################################################
+
 # Goes away in 3.3.
 import bbb.site
 
@@ -240,9 +263,10 @@
         self.permission = permission
 
     def component(self):
-        # Import here, so that we only have a soft dependence on
-        # zope.app.module
-        from zope.app.module import resolve
+# Didn't work ... tests failed
+##         # Import here, so that we only have a soft dependence on
+##         # zope.app.module
+##         from zope.app.module import resolve
         factory = resolve(self.factoryName, self)
         return factory
     component = property(component)

Deleted: Zope3/trunk/src/zope/app/introspector/DEPENDENCIES.cfg
===================================================================
--- Zope3/trunk/src/zope/app/introspector/DEPENDENCIES.cfg	2005-06-14 10:59:36 UTC (rev 30792)
+++ Zope3/trunk/src/zope/app/introspector/DEPENDENCIES.cfg	2005-06-14 11:47:39 UTC (rev 30793)
@@ -1,3 +0,0 @@
-# XXX This dependency should not exist!
-
-zope.app.module

Modified: Zope3/trunk/src/zope/app/introspector/__init__.py
===================================================================
--- Zope3/trunk/src/zope/app/introspector/__init__.py	2005-06-14 10:59:36 UTC (rev 30792)
+++ Zope3/trunk/src/zope/app/introspector/__init__.py	2005-06-14 11:47:39 UTC (rev 30793)
@@ -27,8 +27,31 @@
 from zope.app import zapi
 from zope.app.component.interface import searchInterface, getInterface
 from zope.app.introspector.interfaces import IIntrospector
-from zope.app.module import resolve
 
+##############################################################################
+# from zope.app.module import resolve
+
+# Break the dependency on zope.app.module.  In the long run,
+# we need to handle this better.  Perhaps througha utility.
+
+## def findModule(name, context=None):
+##     """Find the module matching the provided name."""
+##     module = ZopeModuleRegistry.findModule(name)
+##     return module or sys.modules.get(name)
+
+import sys
+
+def resolve(name, context=None):
+    """Resolve a dotted name to a Python object."""
+    pos = name.rfind('.')
+    mod = sys.modules.get(name[:pos])
+##    mod = findModule(name[:pos], context)
+    return getattr(mod, name[pos+1:], None)
+
+# from zope.app.module import resolve
+##############################################################################
+
+
 class Introspector(object):
     """Introspects an object"""
 



More information about the Zope3-Checkins mailing list