[Zope3-checkins] SVN: Zope3/trunk/ split fssync support for zope.app.registration into a separate package

Fred L. Drake, Jr. fred at zope.com
Mon May 24 16:24:21 EDT 2004


Log message for revision 24947:
split fssync support for zope.app.registration into a separate package


-=-
Added: Zope3/trunk/package-includes/zope.app.registration.fssync-configure.zcml
===================================================================
--- Zope3/trunk/package-includes/zope.app.registration.fssync-configure.zcml	2004-05-24 20:17:28 UTC (rev 24946)
+++ Zope3/trunk/package-includes/zope.app.registration.fssync-configure.zcml	2004-05-24 20:24:21 UTC (rev 24947)
@@ -0,0 +1 @@
+<include package="zope.app.registration.fssync" />


Property changes on: Zope3/trunk/package-includes/zope.app.registration.fssync-configure.zcml
___________________________________________________________________
Name: svn:mime-type
   + text/xml
Name: svn:eol-style
   + native

Modified: Zope3/trunk/src/zope/app/registration/configure.zcml
===================================================================
--- Zope3/trunk/src/zope/app/registration/configure.zcml	2004-05-24 20:17:28 UTC (rev 24946)
+++ Zope3/trunk/src/zope/app/registration/configure.zcml	2004-05-24 20:24:21 UTC (rev 24947)
@@ -1,6 +1,5 @@
 <configure
     xmlns="http://namespaces.zope.org/zope"
-    xmlns:fssync="http://namespaces.zope.org/fssync"
     >
 
   <!-- Registration registries -->
@@ -68,11 +67,4 @@
          zope.app.container.interfaces.IObjectRemovedEvent"
     />
 
-  <!-- Filesystem synchronization support -->
-  
-  <fssync:adapter
-      class=".registration.RegistrationManager"
-      factory="zope.fssync.server.entryadapter.DirectoryAdapter"
-      />
-
 </configure>

Added: Zope3/trunk/src/zope/app/registration/fssync/DEPENDENCIES.cfg
===================================================================
--- Zope3/trunk/src/zope/app/registration/fssync/DEPENDENCIES.cfg	2004-05-24 20:17:28 UTC (rev 24946)
+++ Zope3/trunk/src/zope/app/registration/fssync/DEPENDENCIES.cfg	2004-05-24 20:24:21 UTC (rev 24947)
@@ -0,0 +1,4 @@
+zope.fssync
+zope.interface
+zope.proxy
+zope.xmlpickle

Added: Zope3/trunk/src/zope/app/registration/fssync/SETUP.cfg
===================================================================
--- Zope3/trunk/src/zope/app/registration/fssync/SETUP.cfg	2004-05-24 20:17:28 UTC (rev 24946)
+++ Zope3/trunk/src/zope/app/registration/fssync/SETUP.cfg	2004-05-24 20:24:21 UTC (rev 24947)
@@ -0,0 +1,3 @@
+<data-files skel/etc/package-includes>
+  zope.app.registration.fssync-configure.zcml
+</data-files>

Added: Zope3/trunk/src/zope/app/registration/fssync/__init__.py
===================================================================
--- Zope3/trunk/src/zope/app/registration/fssync/__init__.py	2004-05-24 20:17:28 UTC (rev 24946)
+++ Zope3/trunk/src/zope/app/registration/fssync/__init__.py	2004-05-24 20:24:21 UTC (rev 24947)
@@ -0,0 +1 @@
+# This directory is a Python package.


Property changes on: Zope3/trunk/src/zope/app/registration/fssync/__init__.py
___________________________________________________________________
Name: svn:mime-type
   + text/x-python
Name: svn:eol-style
   + native

Added: Zope3/trunk/src/zope/app/registration/fssync/adapter.py
===================================================================
--- Zope3/trunk/src/zope/app/registration/fssync/adapter.py	2004-05-24 20:17:28 UTC (rev 24946)
+++ Zope3/trunk/src/zope/app/registration/fssync/adapter.py	2004-05-24 20:24:21 UTC (rev 24947)
@@ -0,0 +1,73 @@
+##############################################################################
+#
+# 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.
+#
+##############################################################################
+"""File-system synchronization for registrations.
+
+$Id$
+"""
+from zope.interface import implements
+
+from zope.fssync.server.entryadapter import ObjectEntryAdapter
+from zope.fssync.server.interfaces import IObjectFile
+from zope.proxy import removeAllProxies
+from zope.xmlpickle import dumps, loads
+
+
+class ComponentRegistrationAdapter(ObjectEntryAdapter):
+    """Fssync adapter for ComponentRegistration objects and subclasses.
+
+    This is fairly generic -- it should apply to most subclasses of
+    ComponentRegistration.  But in order for it to work for a
+    specific subclass (say, UtilityRegistration), you have to (a) add
+    an entry to configure.zcml, like this:
+
+        <fssync:adapter
+            class=".utility.UtilityRegistration"
+            factory=".registration.fssync.ComponentRegistrationAdapter"
+            />
+
+    and (b) add a function to factories.py, like this:
+
+        def UtilityRegistration():
+            from zope.app.utility import UtilityRegistration
+            return UtilityRegistration("", None, "")
+
+    The file representation of a registration object is an XML pickle
+    for a modified version of the instance dict.  In this version of
+    the instance dict, the __annotations__ attribute is omitted,
+    because annotations are already stored on the filesystem in a
+    different way (in @@Zope/Annotations/<file>).
+    """
+
+    implements(IObjectFile)
+
+    def factory(self):
+        """See IObjectEntry."""
+        name = self.context.__class__.__name__
+        return "zope.app.registration.factories." + name
+
+    def getBody(self):
+        """See IObjectEntry."""
+        obj = removeAllProxies(self.context)
+        ivars = {}
+        ivars.update(obj.__getstate__())
+        aname = "__annotations__"
+        if aname in ivars:
+            del ivars[aname]
+        return dumps(ivars)
+
+    def setBody(self, body):
+        """See IObjectEntry."""
+        obj = removeAllProxies(self.context)
+        ivars = loads(body)
+        obj.__setstate__(ivars)


Property changes on: Zope3/trunk/src/zope/app/registration/fssync/adapter.py
___________________________________________________________________
Name: svn:mime-type
   + text/x-python
Name: svn:eol-style
   + native

Added: Zope3/trunk/src/zope/app/registration/fssync/configuration.zcml
===================================================================
--- Zope3/trunk/src/zope/app/registration/fssync/configuration.zcml	2004-05-24 20:17:28 UTC (rev 24946)
+++ Zope3/trunk/src/zope/app/registration/fssync/configuration.zcml	2004-05-24 20:24:21 UTC (rev 24947)
@@ -0,0 +1,11 @@
+<configure
+    xmlns="http://namespaces.zope.org/zope"
+    xmlns:fssync="http://namespaces.zope.org/fssync"
+    >
+
+  <fssync:adapter
+      class="zope.app.registration.RegistrationManager"
+      factory="zope.fssync.server.entryadapter.DirectoryAdapter"
+      />
+
+</configure>


Property changes on: Zope3/trunk/src/zope/app/registration/fssync/configuration.zcml
___________________________________________________________________
Name: svn:mime-type
   + text/xml
Name: svn:eol-style
   + native

Added: Zope3/trunk/src/zope/app/registration/fssync/zope.app.registration.fssync-configure.zcml
===================================================================
--- Zope3/trunk/src/zope/app/registration/fssync/zope.app.registration.fssync-configure.zcml	2004-05-24 20:17:28 UTC (rev 24946)
+++ Zope3/trunk/src/zope/app/registration/fssync/zope.app.registration.fssync-configure.zcml	2004-05-24 20:24:21 UTC (rev 24947)
@@ -0,0 +1 @@
+<include package="zope.app.registration.fssync" />


Property changes on: Zope3/trunk/src/zope/app/registration/fssync/zope.app.registration.fssync-configure.zcml
___________________________________________________________________
Name: svn:mime-type
   + text/xml
Name: svn:eol-style
   + native

Modified: Zope3/trunk/src/zope/app/registration/registration.py
===================================================================
--- Zope3/trunk/src/zope/app/registration/registration.py	2004-05-24 20:17:28 UTC (rev 24946)
+++ Zope3/trunk/src/zope/app/registration/registration.py	2004-05-24 20:24:21 UTC (rev 24947)
@@ -21,12 +21,9 @@
 import zope.cachedescriptors.property
 from zope.interface import implements
 from zope.exceptions import DuplicationError
-from zope.fssync.server.entryadapter import ObjectEntryAdapter
-from zope.fssync.server.interfaces import IObjectFile
 from zope.proxy import removeAllProxies, getProxiedObject
 from zope.security.checker import InterfaceChecker, CheckerPublic
 from zope.security.proxy import Proxy, trustedRemoveSecurityProxy
-from zope.xmlpickle import dumps, loads
 
 from zope.app import zapi
 from zope.app.annotation.interfaces import IAttributeAnnotatable
@@ -904,53 +901,3 @@
         l = name.rfind('.')
         mod = self.findModule(name[:l])
         return getattr(mod, name[l+1:])
-
-
-class ComponentRegistrationAdapter(ObjectEntryAdapter):
-    """Fssync adapter for ComponentRegistration objects and subclasses.
-
-    This is fairly generic -- it should apply to most subclasses of
-    ComponentRegistration.  But in order for it to work for a
-    specific subclass (say, UtilityRegistration), you have to (a) add
-    an entry to configure.zcml, like this:
-
-        <fssync:adapter
-            class=".utility.UtilityRegistration"
-            factory=".registration.ComponentRegistrationAdapter"
-            />
-
-    and (b) add a function to factories.py, like this:
-
-        def UtilityRegistration():
-            from zope.app.utility import UtilityRegistration
-            return UtilityRegistration("", None, "")
-
-    The file representation of a registration object is an XML pickle
-    for a modified version of the instance dict.  In this version of
-    the instance dict, the __annotations__ attribute is omitted,
-    because annotations are already stored on the filesystem in a
-    different way (in @@Zope/Annotations/<file>).
-    """
-
-    implements(IObjectFile)
-
-    def factory(self):
-        """See IObjectEntry."""
-        name = self.context.__class__.__name__
-        return "zope.app.registration.factories." + name
-
-    def getBody(self):
-        """See IObjectEntry."""
-        obj = removeAllProxies(self.context)
-        ivars = {}
-        ivars.update(obj.__getstate__())
-        aname = "__annotations__"
-        if aname in ivars:
-            del ivars[aname]
-        return dumps(ivars)
-
-    def setBody(self, body):
-        """See IObjectEntry."""
-        obj = removeAllProxies(self.context)
-        ivars = loads(body)
-        obj.__setstate__(ivars)




More information about the Zope3-Checkins mailing list