[Zope3-checkins] CVS: Zope3/src/zope/app/content - configure.zcml:1.14 fssync.py:1.3
Guido van Rossum
guido@python.org
Tue, 6 May 2003 15:51:32 -0400
Update of /cvs-repository/Zope3/src/zope/app/content
In directory cvs.zope.org:/tmp/cvs-serv26590
Modified Files:
configure.zcml fssync.py
Log Message:
Add the 'add views' for fssync, which make the addtypes command work.
=== Zope3/src/zope/app/content/configure.zcml 1.13 => 1.14 ===
--- Zope3/src/zope/app/content/configure.zcml:1.13 Mon May 5 14:01:00 2003
+++ Zope3/src/zope/app/content/configure.zcml Tue May 6 15:51:32 2003
@@ -385,6 +385,29 @@
provides="zope.app.interfaces.fssync.IObjectFile"
/>
+ <!-- add views -->
+
+<view
+ factory=".fssync.FolderAddView"
+ for="zope.app.interfaces.fssync.IContentDirectory"
+ type="zope.app.interfaces.fssync.IFSAddView"
+ name=".folder"
+ />
+
+<view
+ factory=".fssync.FileAddView"
+ for="zope.app.interfaces.fssync.IContentDirectory"
+ type="zope.app.interfaces.fssync.IFSAddView"
+ name=".file"
+ />
+
+<view
+ factory=".fssync.ZPTAddView"
+ for="zope.app.interfaces.fssync.IContentDirectory"
+ type="zope.app.interfaces.fssync.IFSAddView"
+ name=".pt"
+ />
+
<!-- Further Directives -->
</zopeConfigure>
=== Zope3/src/zope/app/content/fssync.py 1.2 => 1.3 ===
--- Zope3/src/zope/app/content/fssync.py:1.2 Mon May 5 14:01:00 2003
+++ Zope3/src/zope/app/content/fssync.py Tue May 6 15:51:32 2003
@@ -16,8 +16,12 @@
$Id$
"""
-from zope.app.interfaces.fssync import IObjectFile, IContentDirectory
+from zope.app.content.file import File
+from zope.app.content.folder import Folder
+from zope.app.content.zpt import ZPTPage
+from zope.app.fssync.classes import FSAddView
from zope.app.fssync.classes import ObjectEntryAdapter, AttrMapping
+from zope.app.interfaces.fssync import IObjectFile, IContentDirectory
from zope.proxy.context import ContextWrapper
_attrs = ('contentType', )
@@ -64,3 +68,24 @@
def setBody(self, data):
"See IObjectFile"
self.context.setSource(data)
+
+class FolderAddView(FSAddView):
+ """Support to create a filesystem representation of Zope folder objects.
+ """
+
+ def create(self):
+ return Folder()
+
+class FileAddView(FSAddView):
+ """Support to create a filesystem representation of Zope file objects.
+ """
+
+ def create(self):
+ return File()
+
+class ZPTAddView(FSAddView):
+ """Support to create a filesystem representation of ZPT page objects.
+ """
+
+ def create(self, fs_path=None):
+ return ZPTPage()