[Zope3-checkins] CVS: Zope3/src/zope/app/registration - interfaces.py:1.8

Stephan Richter srichter at cosmos.phy.tufts.edu
Sat Apr 24 19:20:18 EDT 2004


Update of /cvs-repository/Zope3/src/zope/app/registration
In directory cvs.zope.org:/tmp/cvs-serv30241/src/zope/app/registration

Modified Files:
	interfaces.py 
Log Message:


Use Choice field instead of special registration status field and widget.




=== Zope3/src/zope/app/registration/interfaces.py 1.7 => 1.8 ===
--- Zope3/src/zope/app/registration/interfaces.py:1.7	Sat Apr 17 11:13:12 2004
+++ Zope3/src/zope/app/registration/interfaces.py	Sat Apr 24 19:19:47 2004
@@ -20,9 +20,8 @@
 from zope.app.annotation.interfaces import IAttributeAnnotatable
 from zope.app.container.interfaces import IContainerNamesContainer
 from zope.app.container.interfaces import IContained, IContainer
-from zope.app.security.permission import PermissionField
 from zope.interface import Interface, Attribute, implements
-from zope.schema import TextLine, Field
+from zope.schema import TextLine, Field, Choice
 from zope.schema.interfaces import ITextLine
 from zope.app.container.constraints import ItemTypePrecondition
 from zope.app.container.constraints import ContainerTypesConstraint
@@ -32,19 +31,6 @@
 RegisteredStatus = _('Registered')
 ActiveStatus = _('Active')
 
-class IRegistrationStatus(ITextLine):
-    """The status of a registration
-    """
-
-class RegistrationStatus(TextLine):
-    implements(IRegistrationStatus)
-
-    def __init__(self, *args, **kw):
-        super(RegistrationStatus, self).__init__(*args, **kw)
-        self.allowed_values = (UnregisteredStatus,
-                               RegisteredStatus,
-                               ActiveStatus)
-
 class INoLocalServiceError(Interface):
     """No local service to register with.
     """
@@ -76,8 +62,10 @@
                             "this registration type")
     # A string; typically a class attribute
 
-    status = RegistrationStatus(
-        title=_("Registration status")
+    status = Choice(
+        title=_("Registration status"),
+        values=(UnregisteredStatus, RegisteredStatus, ActiveStatus),
+        default=UnregisteredStatus
         )
 
     def activated():
@@ -133,8 +121,9 @@
                       "or relative to the nearest site management folder"),
         required=True)
 
-    permission = PermissionField(
+    permission = Choice(
         title=_("The permission needed to use the component"),
+        vocabulary="Permissions",
         required=False,
         )
 




More information about the Zope3-Checkins mailing list