[Zope3-checkins] CVS: Zope3/lib/python/Zope/App/OFS/Services - adapter.py:1.3 interfaces.py:1.3

Steve Alexander steve@cat-box.net
Sun, 22 Dec 2002 16:13:51 -0500


Update of /cvs-repository/Zope3/lib/python/Zope/App/OFS/Services
In directory cvs.zope.org:/tmp/cvs-serv6444/lib/python/Zope/App/OFS/Services

Modified Files:
	adapter.py interfaces.py 
Log Message:
Made the forInterface field not required, so you can haev adapters from
None. Maybe a better way of doing this would be to have "None" appear in
the list of forInterfaces.


=== Zope3/lib/python/Zope/App/OFS/Services/adapter.py 1.2 => 1.3 ===
--- Zope3/lib/python/Zope/App/OFS/Services/adapter.py:1.2	Thu Dec 19 15:38:21 2002
+++ Zope3/lib/python/Zope/App/OFS/Services/adapter.py	Sun Dec 22 16:13:50 2002
@@ -148,7 +148,15 @@
 
     status = ConfigurationStatusProperty('Adapters')
 
-    def __init__(self, forInterface, providedInterface, factoryName):
+    # XXX These should be positional arguments, except that forInterface
+    #     isn't passed in if it is omitted. To fix this, we need a
+    #     required=False,explicitly_unrequired=True in the schema field
+    #     so None will get passed in.
+    def __init__(self, forInterface=None, providedInterface=None,
+                 factoryName=None):
+        if None in (providedInterface, factoryName):
+            raise TypeError(
+                "Must provide 'providedInterface' and 'factoryName'")
         self.forInterface = forInterface
         self.providedInterface = providedInterface
         self.factoryName = factoryName


=== Zope3/lib/python/Zope/App/OFS/Services/interfaces.py 1.2 => 1.3 ===
--- Zope3/lib/python/Zope/App/OFS/Services/interfaces.py:1.2	Thu Dec 19 15:38:21 2002
+++ Zope3/lib/python/Zope/App/OFS/Services/interfaces.py	Sun Dec 22 16:13:50 2002
@@ -29,8 +29,8 @@
         title = u"For interface",
         description = u"The interface of the objects being adapted",
         readonly = True,
-        required = True,
-        )
+        required = False,  # XXX the UI should be explicit about allowing
+        )                  #     no selection.
 
     providedInterface = InterfaceField(
         title = u"Provided interface",