[Zope3-checkins] CVS: Zope3/src/zope/component - __init__.py:1.16.10.1 interfaces.py:1.19.10.1

Garrett Smith garrett at mojave-corp.com
Sun Feb 8 18:54:56 EST 2004


Update of /cvs-repository/Zope3/src/zope/component
In directory cvs.zope.org:/tmp/cvs-serv22019/src/zope/component

Modified Files:
      Tag: ozzope-widgets-branch
	__init__.py interfaces.py 
Log Message:

Multiple changes:

- Added getViewProviding and queryViewProviding methods to zapi. These are
  used to lookup a view based on an interface it provides.

- Fixed a misspecified interface in rotterdamn textarea edit widget.

- Rework of utility.py in progress - tests broken.

- Removed the old view service.


=== Zope3/src/zope/component/__init__.py 1.16 => 1.16.10.1 ===
--- Zope3/src/zope/component/__init__.py:1.16	Fri Dec 19 11:53:20 2003
+++ Zope3/src/zope/component/__init__.py	Sun Feb  8 18:54:25 2004
@@ -156,6 +156,13 @@
 
 queryView = hookable(queryView)
 
+def getViewProviding(object, providing, request, context=None):
+    return getView(object, '', request, context, providing)
+    
+def queryViewProviding(object, providing, request, default=None, 
+                       context=None):
+    return queryView(object, '', request, default, context, providing)
+
 def getDefaultViewName(object, request, context=None):
     v = queryDefaultViewName(object, request, context=context)
     if v is not None:


=== Zope3/src/zope/component/interfaces.py 1.19 => 1.19.10.1 ===
--- Zope3/src/zope/component/interfaces.py:1.19	Thu Jan  8 15:48:22 2004
+++ Zope3/src/zope/component/interfaces.py	Sun Feb  8 18:54:25 2004
@@ -47,7 +47,8 @@
         the given context, in the format {nameString: serviceInterface}.
         If the context is None the global definitions will be returned.
         The default behavior of placeful service managers is to include
-        service definitions above them, but this can be overridden"""
+        service definitions above them, but this can be overridden.
+        """
 
     # Utility service
 
@@ -57,20 +58,19 @@
         Returns the nearest utility to the context that implements the
         specified interface.  If one is not found, raises
         ComponentLookupError.
-
         """
 
     def queryUtility(context, interface, default=None, name=''):
         """Look for the utility that provides interface
 
         Returns the nearest utility to the context that implements
-        the specified interface.  If one is not found, returns default."""
+        the specified interface.  If one is not found, returns default.
+        """
 
     def getUtilitiesFor(context, interface):
         """Look up the registered utilities that provide an interface.
 
         Returns the list of utilities found
-
         """
         
     # Adapter service
@@ -88,7 +88,6 @@
         non-None value, that value will be returned. Otherwise, if the
         object already implements the interface, the object will be
         returned.
-
         """
 
     def getNamedAdapter(object, interface, name, context=None):
@@ -102,7 +101,6 @@
         The name consisting of an empty string is reserved for unnamed
         adapters. The unnamed adapter methods will often call the
         named adapter methods with an empty string for a name.
-
         """
 
     def queryAdapter(object, interface, default=None, context=None):
@@ -118,7 +116,6 @@
         non-None value, that value will be returned. Otherwise, if the
         object already implements the interface, the object will be
         returned.
-
         """
 
     def queryNamedAdapter(object, interface, name, default=None, context=None):
@@ -132,7 +129,6 @@
         The name consisting of an empty string is reserved for unnamed
         adapters. The unnamed adapter methods will often call the
         named adapter methods with an empty string for a name.
-
         """
 
     # Factory service
@@ -145,7 +141,6 @@
         to create a new instance. Returns a reference to the new
         object.  If a matching factory cannot be found raises
         ComponentLookupError
-
         """
 
     def getFactory(context, name):
@@ -154,7 +149,6 @@
         Get the factory of the given name that is nearest to the
         context.  If a matching factory cannot be found raises
         ComponentLookupError
-
         """
 
     def queryFactory(context, name, default=None):
@@ -163,7 +157,6 @@
         Get the factory of the given name that is nearest to the
         context.  If a matching factory cannot be found then the
         default is returned.
-
         """
 
     def getFactoryInterfaces(context, name):
@@ -171,7 +164,8 @@
 
         finds the factory of the given name that is nearest to the
         context, and returns the interface or interface tuple that
-        object instances created by the named factory will implement."""
+        object instances created by the named factory will implement.
+        """
 
     # Presentation service
 
@@ -186,7 +180,6 @@
 
         If context is not specified, attempts to use wrapping around
         object to specify a context.
-
         """
 
     def queryView(object, name, request,
@@ -199,7 +192,23 @@
 
         If context is not specified, attempts to use wrapping around
         object to specify a context.
-
+        """
+        
+    def getViewProviding(object, providing, request, context=None):
+        """Look for a view based on the interface it provides.
+        
+        A call to this method is equivalent to:
+            
+            getView(object, '', request, context, providing)
+        """
+        
+    def queryViewProviding(object, providing, request, 
+                           default=None, context=None):
+        """Look for a view that provides the specified interface.
+        
+        A call to this method is equivalent to:
+            
+            queryView(object, '', request, default, context, providing)
         """
 
     def getDefaultViewName(object, request, context=None):
@@ -212,7 +221,6 @@
 
         If context is not specified, attempts to use wrapping around
         object to specify a context.
-
         """
 
     def queryDefaultViewName(object, request, default=None, context=None):
@@ -225,7 +233,6 @@
 
         If context is not specified, attempts to use wrapping around
         object to specify a context.
-
         """
 
     def getResource(wrapped_object, name, request, providing=Interface):
@@ -237,7 +244,6 @@
 
         A ComponentLookupError will be raised if the component can't
         be found.
-
         """
 
     def queryResource(wrapped_object, name, request,
@@ -267,17 +273,14 @@
         """Retrieve a service implementation
 
         Raises ComponentLookupError if the service can't be found.
-
         """
 
     def queryService(name, default=None):
         """Look for a named service.
 
         Return the default if the service can't be found.
-
         """
 
-
 class IFactory(Interface):
 
     # XXX Because __call__ does not receive a context, it is not possible
@@ -359,21 +362,18 @@
         """Look up a utility that provides an interface.
 
         If one is not found, raises ComponentLookupError.
-
         """
 
     def queryUtility(interface, default=None, name=''):
         """Look up a utility that provides an interface.
 
         If one is not found, returns default.
-
         """
 
     def getUtilitiesFor(interface):
         """Look up the registered utilities that provide an interface.
 
         If none is found, return an empty list
-
         """
 
 class IContextDependent(Interface):
@@ -382,7 +382,6 @@
         """The context of the object
 
         This is the object being adapted, viewed, extended, etc.
-
         """)
 
 class IAdapterService(Interface):
@@ -391,7 +390,6 @@
         """Look for an adapter to an interface for an object
 
         If a matching adapter cannot be found, returns the default.
-
         """
 
     def queryNamedAdapter(object, interface, name, default=None):
@@ -402,7 +400,6 @@
         The name consisting of an empty string is reserved for unnamed
         adapters. The unnamed adapter methods will often call the
         named adapter methods with an empty string for a name.
-
         """
 
     def queryMultiAdapter(objects, interface, name, default=None):
@@ -413,7 +410,6 @@
         The name consisting of an empty string is reserved for unnamed
         adapters. The unnamed adapter methods will often call the
         named adapter methods with an empty string for a name.
-
         """
 
     # XXX need to add name support
@@ -434,7 +430,6 @@
 
         - the object registered specifically for the required and
           provided interfaces.
-
         """
 
 class IPresentation(Interface):
@@ -442,7 +437,6 @@
 
     The are created for requests, which encapsulate external actors,
     connections, etc.
-
     """
 
     request = Attribute(
@@ -451,12 +445,10 @@
         The request is a surrogate for the user. It also provides the
         presentation type and skin. It is of type
         IPresentationRequest.
-
         """)
 
 class IPresentationRequest(Interface):
-    """An IPresentationRequest provides methods for getting view meta data.
-    """
+    """An IPresentationRequest provides methods for getting view meta data."""
 
     def getPresentationSkin():
         """Get the skin to be used for a request.
@@ -466,8 +458,7 @@
         """
 
 class IResource(IPresentation):
-    """Resources provide data to be used for presentation.
-    """
+    """Resources provide data to be used for presentation."""
 
 class IResourceFactory(Interface):
 
@@ -475,16 +466,13 @@
         """Create a resource for a request
 
         The request must be an IPresentationRequest.
-
         """
 
 class IView(IPresentation, IContextDependent):
-    """Views provide a connection between an external actor and an object
-    """
+    """Views provide a connection between an external actor and an object"""
 
 class IViewFactory(Interface):
-    """Objects for creating views
-    """
+    """Objects for creating views"""
 
     def __call__(context, request):
         """Create an view (IView) object
@@ -519,7 +507,4 @@
         The first argument is a tuple of objects to be adapted with the
         request.
         """
-        
-        
-        
-        
+




More information about the Zope3-Checkins mailing list