[Zope3-checkins] CVS: Zope3/src/zope/app/services - configure.zcml:1.31 module.py:1.6

Guido van Rossum guido@python.org
Thu, 29 May 2003 17:33:09 -0400


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

Modified Files:
	configure.zcml module.py 
Log Message:
Add a fssync adapter for persistent modules.  The "body" of the module
is its source.  The only extra information is the module name (which
isn't necessarily the file name!).


=== Zope3/src/zope/app/services/configure.zcml 1.30 => 1.31 ===
--- Zope3/src/zope/app/services/configure.zcml:1.30	Thu May 29 15:55:42 2003
+++ Zope3/src/zope/app/services/configure.zcml	Thu May 29 17:33:08 2003
@@ -501,6 +501,11 @@
     factory=".zpt.ZPTPageAdapter"
     />
 
+<fssync:adapter
+    class=".module.Manager"
+    factory=".module.ModuleAdapter"
+    />
+
 <adapter 
   for="zope.app.interfaces.services.service.IServiceManager"
   provides="zope.app.interfaces.file.IDirectoryFactory"


=== Zope3/src/zope/app/services/module.py 1.5 => 1.6 ===
--- Zope3/src/zope/app/services/module.py:1.5	Thu May 29 17:08:34 2003
+++ Zope3/src/zope/app/services/module.py	Thu May 29 17:33:09 2003
@@ -27,6 +27,9 @@
 
 from zope.interface import implements
 
+from zope.app.fssync.classes import ObjectEntryAdapter, AttrMapping
+from zope.app.interfaces.fssync import IObjectFile
+
 
 class Registry:
 
@@ -100,3 +103,17 @@
 
     name = property(lambda self: self._manager.name)
     source = property(lambda self: self._manager.source)
+
+
+class ModuleAdapter(ObjectEntryAdapter):
+
+    __implements__ =  IObjectFile
+
+    def getBody(self):
+        return self.context.source
+
+    def setBody(self, source):
+        self.context.update(source)
+
+    def extra(self):
+        return AttrMapping(self.context, ("name",))