[Zope-Checkins] CVS: Packages/ComponentArchitecture - FactoryComponents.py:1.1.2.1 InputToName.py:1.1.2.1 Errors.py:1.1.2.4 InterfaceComponents.py:1.1.2.2 Presentation.py:1.1.2.5

Shane Hathaway shane@digicool.com
Wed, 1 Aug 2001 19:05:34 -0400


Update of /cvs-repository/Packages/ComponentArchitecture
In directory cvs.zope.org:/tmp/cvs-serv21301

Modified Files:
      Tag: NR-branch
	Errors.py InterfaceComponents.py Presentation.py 
Added Files:
      Tag: NR-branch
	FactoryComponents.py InputToName.py 
Log Message:
Refining, generalizing, etc.  (Most of the work is going on in a separate
product.)

 
=== Added File Packages/ComponentArchitecture/FactoryComponents.py ===


=== Added File Packages/ComponentArchitecture/InputToName.py ===


=== Packages/ComponentArchitecture/Errors.py 1.1.2.3 => 1.1.2.4 ===
 
 
-class PresentationNotFound (Exception):
-    """Could not find the necessary presentation for a component"""
-
+class ObjectAndNameException (Exception):
     def __init__(self, object, name):
         self.object = object
         self.name = name
@@ -107,16 +105,14 @@
         return 'Object: %s, name: %s' % (`self.object`,
                                          `self.name`)
 
+class PresentationNotFound (ObjectAndNameException):
+    """Could not find the necessary presentation for a component"""
 
-class InterfaceNotFound (Exception):
-    """Could not find an interface"""
 
-    def __init__(self, object, name):
-        self.object = object
-        self.name = name
+class InterfaceNotFound (ObjectAndNameException):
+    """Could not find an interface"""
 
-    def __str__(self):
-        return 'Object: %s, name: %s' % (`self.object`,
-                                         `self.name`)
 
+class FactoryNotFound (ObjectAndNameException):
+    """Could not find a factory"""
 


=== Packages/ComponentArchitecture/InterfaceComponents.py 1.1.2.1 => 1.1.2.2 ===
 
 def _flattenWithNames(object, interfaces, append):
+    # Helper for objectImplements().
     for i in interfaces:
         if isinstance(i, Interface):
             append(i)


=== Packages/ComponentArchitecture/Presentation.py 1.1.2.4 => 1.1.2.5 ===
     '''
 
-    def getPresentationFactory(inputs, name):
+    def getBinder(inputs, name):
         '''
 
         Returns None if unable to provide presentation.
         '''
 
 
-class PresentationFactory (Interface.Base):
+class PresentationBinder (Interface.Base):
     '''
     '''
 
@@ -119,15 +119,8 @@
 
 class PresentationComponent (Interface.Base):
     '''
-    Holds a PresentationFactory.
+    Holds a PresentationBinder.
     '''
-    def getNames():
-        '''
-        '''
-
-    def getInputs():
-        '''
-        '''
 
 
 _marker = []  # Create a new marker object.
@@ -172,7 +165,7 @@
             # inputs is an interface object.
             return self._getPresentation(inputs, name)
 
-    def getPresentationFactory(self, inputs, name):
+    def getBinder(self, inputs, name):
         if inputs:
             p = self._getPresentationForInterfaces(inputs, name)
         else:
@@ -189,7 +182,7 @@
     '''
     ps = sm.getService(PRESENTATION_SERVICE_NAME, None)
     if ps is not None:
-        pres = ps.getPresentationFactory(inputs, name)
+        pres = ps.getBinder(inputs, name)
         if pres is not None:
             result.append(pres)
             return 1
@@ -210,11 +203,11 @@
     if result:
         p = result[0]
     else:
-        p = global_reg.getPresentationFactory(inputs, name)
+        p = global_reg.getBinder(inputs, name)
         if p is None:
             if default is not _marker:
                 return default
             else:
                 raise Errors.PresentationNotFound(object, name)
-    assert PresentationFactory.isImplementedBy(p)
+    assert PresentationBinder.isImplementedBy(p)
     return p(object)