[Zope3-checkins] CVS: Zope3/lib/python/Zope/App/ComponentArchitecture - InterfaceField.py:1.2 IInterfaceService.py:1.3 configure.zcml:1.8
Jim Fulton
jim@zope.com
Wed, 4 Dec 2002 04:54:36 -0500
Update of /cvs-repository/Zope3/lib/python/Zope/App/ComponentArchitecture
In directory cvs.zope.org:/tmp/cvs-serv13028
Modified Files:
IInterfaceService.py configure.zcml
Added Files:
InterfaceField.py
Log Message:
Added interface fields and widgets for keeping track of interfaces
(e.g. for adapter configurations).
=== Zope3/lib/python/Zope/App/ComponentArchitecture/InterfaceField.py 1.1 => 1.2 ===
--- /dev/null Wed Dec 4 04:54:36 2002
+++ Zope3/lib/python/Zope/App/ComponentArchitecture/InterfaceField.py Wed Dec 4 04:54:04 2002
@@ -0,0 +1,40 @@
+##############################################################################
+#
+# Copyright (c) 2002 Zope Corporation and Contributors.
+# All Rights Reserved.
+#
+# This software is subject to the provisions of the Zope Public License,
+# Version 2.0 (ZPL). A copy of the ZPL should accompany this distribution.
+# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
+# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
+# FOR A PARTICULAR PURPOSE.
+#
+##############################################################################
+"""These are the interfaces for the common fields.
+
+$Id$
+"""
+
+from Zope.Schema.IField import IEnumeratable
+from Zope.Schema import Enumeratable
+from Interface import Interface
+from Interface.IInterface import IInterface
+from Zope.Schema.Exceptions import ValidationError
+
+class IInterfaceField(IEnumeratable):
+ u"""Fields with Interfaces as values
+ """
+
+class InterfaceField(Enumeratable):
+ __doc__ = IInterfaceField.__doc__
+ __implements__ = IInterfaceField
+
+
+ def _validate(self, value):
+ super(InterfaceField, self)._validate(value)
+
+ if not IInterface.isImplementedBy(value):
+ raise ValidationError("Not an interface", value)
+
+
=== Zope3/lib/python/Zope/App/ComponentArchitecture/IInterfaceService.py 1.2 => 1.3 ===
--- Zope3/lib/python/Zope/App/ComponentArchitecture/IInterfaceService.py:1.2 Tue Nov 19 18:15:14 2002
+++ Zope3/lib/python/Zope/App/ComponentArchitecture/IInterfaceService.py Wed Dec 4 04:54:04 2002
@@ -18,7 +18,7 @@
from Interface import Interface
class IInterfaceService(Interface):
- """
+ """Service that keeps track of used interfaces
"""
def getInterface(id):
=== Zope3/lib/python/Zope/App/ComponentArchitecture/configure.zcml 1.7 => 1.8 ===
--- Zope3/lib/python/Zope/App/ComponentArchitecture/configure.zcml:1.7 Tue Nov 19 18:15:14 2002
+++ Zope3/lib/python/Zope/App/ComponentArchitecture/configure.zcml Wed Dec 4 04:54:04 2002
@@ -49,9 +49,13 @@
<serviceType id='Interfaces'
interface='Zope.App.ComponentArchitecture.IInterfaceService.' />
- <service serviceType='Interfaces'
- permission='Zope.Public'
- component='Zope.App.ComponentArchitecture.InterfaceService.interfaceService' />
+ <service
+ serviceType='Interfaces'
+ permission='Zope.Public'
+ component=
+ 'Zope.App.ComponentArchitecture.InterfaceService.interfaceService' />
+
+ <include package="Zope.App.ComponentArchitecture.Browser" />
</zopeConfigure>