[Zope-Checkins] CVS: Zope3/lib/python/Zope/ComponentArchitecture - IComponentArchitecture.py:1.1.2.6 __init__.py:1.1.6.6 hooks.py:1.1.2.10 metaConfigure.py:1.1.2.5

Fred Drake Jr fdrake@acm.org
Wed, 12 Dec 2001 14:59:12 -0500


Update of /cvs-repository/Zope3/lib/python/Zope/ComponentArchitecture
In directory cvs.zope.org:/tmp/cvs-serv4030

Modified Files:
      Tag: Zope-3x-branch
	IComponentArchitecture.py __init__.py hooks.py 
	metaConfigure.py 
Log Message:
Feature --> Adapter

=== Zope3/lib/python/Zope/ComponentArchitecture/IComponentArchitecture.py 1.1.2.5 => 1.1.2.6 ===
 class IComponentArchitecture(Interface):
 
-    def provideFeature(forInterface, providedInterface, maker):
-        """Provide a feature
+    def provideAdapter(forInterface, providedInterface, maker):
+        """Provide an adapter
 
-        A feature provides an interface for objects that have another
+        An adapter provides an interface for objects that have another
         interface.
 
         Arguments:
 
-        forInterface -- The interface the feature provides an interface for.
+        forInterface -- The interface the adapter provides an interface for.
 
         providedInterface -- The provided interface
 
-        maker -- a callable object that gets an feature component for
+        maker -- a callable object that gets an adapter component for
         a context component.
         """
 
-    def getFeature(object, interface, default=None):
-        """Look up a feature that provides an interface for an object
+    def getAdapter(object, interface, default=None):
+        """Look up an adapter that provides an interface for an object
 
-        The object also provides a place to look for placeful features.
+        The object also provides a place to look for placeful adapters.
 
         A Zope.ComponentArchitecture.ComponentLookupError will be
         raised if the component can't be found.
@@ -43,7 +43,7 @@
     def getUtility(object, interface, default=None):
         """Look up a utility that provides an interface
 
-        The object provides a place to look for placeful features.
+        The object provides a place to look for placeful adapters.
 
         A Zope.ComponentArchitecture.ComponentLookupError will be
         raised if the component can't be found.


=== Zope3/lib/python/Zope/ComponentArchitecture/__init__.py 1.1.6.5 => 1.1.6.6 ===
 # FOR A PARTICULAR PURPOSE.
 
-from hooks import provideFeature, getFeature
+from hooks import provideAdapter, getAdapter
 from hooks import provideUtility, getUtility
 from hooks import providePresentation, getPresentation
 from hooks import provideFactory, createObject


=== Zope3/lib/python/Zope/ComponentArchitecture/hooks.py 1.1.2.9 => 1.1.2.10 ===
 
 _marker=[]
-def provideFeature(forInterface, providedInterface, maker):
-    return provideFeature_hook(forInterface, providedInterface, maker)
+def provideAdapter(forInterface, providedInterface, maker):
+    return provideAdapter_hook(forInterface, providedInterface, maker)
 
-def getFeature(object, interface, default=_marker):
-    r=getFeature_hook(object, interface, default)
+def getAdapter(object, interface, default=_marker):
+    r=getAdapter_hook(object, interface, default)
     if r is _marker: raise ComponentLookupError(object, interface)
     return r
         
@@ -46,12 +46,12 @@
 
 from IToIRegistry import IToIRegistry, IRegistry
 
-def provideFeature_hook(forInterface, providedInterface, maker):
-    _features.register(forInterface, providedInterface, maker)
+def provideAdapter_hook(forInterface, providedInterface, maker):
+    _adapters.register(forInterface, providedInterface, maker)
 
-def getFeature_hook(object, interface, default=None):
+def getAdapter_hook(object, interface, default=None):
     if interface.isImplementedBy(object): return object
-    c=_features.getForObject(object, interface)
+    c = _adapters.getForObject(object, interface)
     if c is None: return default
     return c(object)
 
@@ -92,8 +92,8 @@
     return factory()
 
 def _clear():
-    global _features, _utilities, _presentations, _factories
-    _features = IToIRegistry()
+    global _adapters, _utilities, _presentations, _factories
+    _adapters = IToIRegistry()
     _utilities = IRegistry()
     _presentations = {}
     _factories = {}


=== Zope3/lib/python/Zope/ComponentArchitecture/metaConfigure.py 1.1.2.4 => 1.1.2.5 ===
 # FOR A PARTICULAR PURPOSE.
 
-from hooks import provideFeature, provideUtility, providePresentation
+from hooks import provideAdapter, provideUtility, providePresentation
 from Zope.Configuration.meta import register
 from Zope.Configuration.name import resolve
 from Zope.Configuration import namespace
 
-def provideFeatureDir(component, provides, for_=None):
+def provideAdapterDir(component, provides, for_=None):
     if for_ is not None: for_ = resolve(for_)
-    provideFeature(for_, resolve(provides), resolve(component))
+    provideAdapter(for_, resolve(provides), resolve(component))
 
 def provideUtilityDir(component, provides):
     provideUtility(resolve(provides), resolve(component))
@@ -27,7 +27,7 @@
     providePresentation(for_, "", resolve(type), resolve(component))
 
 def metaConfigure():
-    register(namespace('zope'), 'feature', provideFeatureDir)
+    register(namespace('zope'), 'adapter', provideAdapterDir)
     register(namespace('zope'), 'utility', provideUtilityDir)
     register(namespace('zope'), 'presention', providePresentationDir)
     register(namespace('zope'), 'defaultPresention',