[Zope3-checkins] CVS: Zope3/src/zope/app/interfaces/services - module.py:1.5.6.1

Fred L. Drake, Jr. fred at zope.com
Thu Jan 15 15:50:51 EST 2004


Update of /cvs-repository/Zope3/src/zope/app/interfaces/services
In directory cvs.zope.org:/tmp/cvs-serv1563/src/zope/app/interfaces/services

Modified Files:
      Tag: zope3-fdrake-globalized-modules-branch
	module.py 
Log Message:
Checkpointing the current state of the module globalization work on a branch
so it does not get lost.  See http://dev.zope.org/Zope3/ModulesAreGlobal.


=== Zope3/src/zope/app/interfaces/services/module.py 1.5 => 1.5.6.1 ===
--- Zope3/src/zope/app/interfaces/services/module.py:1.5	Thu Dec 18 05:29:48 2003
+++ Zope3/src/zope/app/interfaces/services/module.py	Thu Jan 15 15:50:20 2004
@@ -20,10 +20,13 @@
 """
 
 from zope.interface import Interface
-from zope.schema import Bytes, ASCII, BytesLine
+from zope.schema import Bytes, ASCII, DottedName
 
+from zope.app.i18n import ZopeMessageIDFactory as _
+from zope.app.interfaces.services import registration
 
-class IModuleManager(Interface):
+
+class IModuleManager(registration.IRegisterable):
     """Content object providing management support for persistent modules."""
 
     def execute():
@@ -37,13 +40,45 @@
         this method.
         """
 
-    
-    name = BytesLine(title=u"The module's name.", readonly=True)
+    def getSize():
+        """Return the size of the module, in bytes.
+
+        This is used by the ISized adaptation.
+        """
+
+    name = DottedName(title=_("The module's name."),
+                      readonly=True)
+
+    source = ASCII(title=_("The module's source code."))
 
-    source = ASCII(title=u"The module's source code.")
+
+# Module registration and service
+
+class IModuleRegistration(registration.INamedComponentRegistration):
+    """Registration object for a module.
+
+    Creating an IModuleRegistration for a persistent module causes it
+    to be a 'global' module.  Activating the registration causes the
+    corresponding global module object to be updated and to track
+    updates to the persistent module.
+
+    IModuleRegistration objects are referenced from the global module
+    service as well as from their containing site management folder.
+    """
+    
+    name = DottedName(
+        title=_("Name"),
+        description=_("The name of the global module"),
+        readonly=True,
+        # Don't allow empty or missing name:
+        required=True,
+        min_length=1,
+        # require that the module exist in some package:
+        min_dots=1,
+        )
 
 
-class IModuleService(Interface):
+class IModuleService(registration.INameComponentRegistry):
     """Objects that can resolve dotted names to objects
     """
 




More information about the Zope3-Checkins mailing list