[Zope3-checkins] CVS: Zope3/src/zope/app/vfs/services - __init__.py:1.2 configure.zcml:1.2 package.py:1.2 service.py:1.2 zpt.py:1.2
Jim Fulton
jim@zope.com
Wed, 25 Dec 2002 09:14:00 -0500
Update of /cvs-repository/Zope3/src/zope/app/vfs/services
In directory cvs.zope.org:/tmp/cvs-serv15352/src/zope/app/vfs/services
Added Files:
__init__.py configure.zcml package.py service.py zpt.py
Log Message:
Grand renaming:
- Renamed most files (especially python modules) to lower case.
- Moved views and interfaces into separate hierarchies within each
project, where each top-level directory under the zope package
is a separate project.
- Moved everything to src from lib/python.
lib/python will eventually go away. I need access to the cvs
repository to make this happen, however.
There are probably some bits that are broken. All tests pass
and zope runs, but I haven't tried everything. There are a number
of cleanups I'll work on tomorrow.
=== Zope3/src/zope/app/vfs/services/__init__.py 1.1 => 1.2 ===
--- /dev/null Wed Dec 25 09:14:00 2002
+++ Zope3/src/zope/app/vfs/services/__init__.py Wed Dec 25 09:13:30 2002
@@ -0,0 +1,2 @@
+#
+# This file is necessary to make this directory a package.
=== Zope3/src/zope/app/vfs/services/configure.zcml 1.1 => 1.2 ===
--- /dev/null Wed Dec 25 09:14:00 2002
+++ Zope3/src/zope/app/vfs/services/configure.zcml Wed Dec 25 09:13:30 2002
@@ -0,0 +1,76 @@
+<zopeConfigure
+ xmlns="http://namespaces.zope.org/zope"
+ xmlns:vfs="http://namespaces.zope.org/vfs">
+
+<!-- ZPT -->
+
+ <vfs:view name="vfs"
+ for="zope.app.interfaces.services.interfaces.IZPTTemplate"
+ permission="zope.View"
+ allowed_interface="zope.publisher.interfaces.vfs.IVFSFilePublisher"
+ factory="zope.app.vfs.services.zpt.ZPTTemplateView" />
+
+ <vfs:view
+ name=".pt"
+ for="zope.app.interfaces.services.package.IPackageAdding"
+ factory="zope.app.vfs.services.zpt.ZPTTemplateAdd"
+ permission="zope.ManageContent" />
+
+ <vfs:view
+ name=".zpt"
+ for="zope.app.interfaces.services.package.IPackageAdding"
+ factory="zope.app.vfs.services.zpt.ZPTTemplateAdd"
+ permission="zope.ManageContent" />
+
+<!-- XXX ??? -->
+
+ <!-- Note that we have to use another Adding interface here, since
+ it conflicts otherwise with the content namespace definitions. -->
+
+ <vfs:view
+ for="zope.app.interfaces.services.package.IPackage"
+ name="+"
+ factory="zope.app.vfs.services.package.PackageAdding"
+ allowed_attributes="setContentName add"
+ permission="zope.ManageContent" />
+
+
+ <vfs:view
+ for="zope.app.interfaces.container.IContainer"
+ name="+"
+ factory="zope.app.vfs.container.adding.Adding"
+ allowed_attributes="setContentName add"
+ permission="zope.ManageContent" />
+
+ <vfs:view
+ name="Package"
+ for="zope.app.interfaces.container.IAdding"
+ factory="zope.app.vfs.services.package.PackageAdd"
+ permission="zope.ManageContent" />
+
+
+ <vfs:view
+ name="vfs"
+ for="zope.app.interfaces.services.service.IServiceManager"
+ permission="zope.ManageContent"
+ allowed_interface="zope.publisher.interfaces.vfs.IVFSDirectoryPublisher"
+ factory="zope.app.vfs.services.service.ServiceManagerView"
+ />
+
+ <vfs:view
+ name="vfs"
+ for="zope.app.interfaces.services.package.IPackages"
+ permission="zope.ManageContent"
+ allowed_interface="zope.publisher.interfaces.vfs.IVFSDirectoryPublisher"
+ factory="zope.app.vfs.services.package.PackagesView"
+ />
+
+ <vfs:view
+ name="vfs"
+ for="zope.app.interfaces.services.package.IPackage"
+ permission="zope.ManageContent"
+ allowed_interface="zope.publisher.interfaces.vfs.IVFSDirectoryPublisher"
+ factory="zope.app.vfs.services.package.PackageView"
+ />
+
+</zopeConfigure>
=== Zope3/src/zope/app/vfs/services/package.py 1.1 => 1.2 ===
--- /dev/null Wed Dec 25 09:14:00 2002
+++ Zope3/src/zope/app/vfs/services/package.py Wed Dec 25 09:13:30 2002
@@ -0,0 +1,100 @@
+##############################################################################
+#
+# 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.
+#
+##############################################################################
+"""VFS Package Add View
+
+$Id$
+"""
+from zope.publisher.vfs import VFSView
+
+from zope.event import publish
+from zope.app.event.objectevent import ObjectCreatedEvent
+
+from zope.app.interfaces.container import IAdding
+from zope.app.services.package import Package
+
+
+class PackageAdd(VFSView):
+ "Provide a user interface for adding a Package content object"
+
+ __used_for__ = IAdding
+
+ def __call__(self):
+ "Add a folder"
+ content = Package()
+ publish(self.context, ObjectCreatedEvent(content))
+ return self.context.add(content)
+
+
+
+"""Adding View for IPackage
+
+$Id$
+"""
+from zope.publisher.vfs import VFSView
+from zope.app.vfs.container.adding import Adding
+from zope.app.interfaces.services.package import IPackageAdding
+
+class PackageAdding(Adding):
+
+ __implements__ = IPackageAdding, VFSView.__implements__
+
+
+"""VFS-View for IPackages
+
+$Id$
+"""
+import datetime
+zerotime = datetime.datetime.fromtimestamp(0)
+
+from zope.component import getAdapter
+from zope.app.interfaces.dublincore import IZopeDublinCore
+from zope.app.vfs.container.view import \
+ VFSContainerView
+
+class PackagesView(VFSContainerView):
+ """Specific Packages VFS view."""
+
+ __implments__ = VFSContainerView.__implements__
+
+ _directory_type = 'Package'
+
+ def remove(self, name):
+ 'See IVFSDirectoryPublisher'
+ pass # not applicable
+
+ def writefile(self, name, mode, instream, start=0):
+ 'See IVFSDirectoryPublisher'
+ pass # not applicable
+
+
+
+
+"""VFS-View for IPackage
+
+$Id$
+"""
+import datetime
+zerotime = datetime.datetime.fromtimestamp(0)
+
+from zope.component import getAdapter
+from zope.app.interfaces.dublincore import IZopeDublinCore
+from zope.app.vfs.container.view import \
+ VFSContainerView
+
+class PackageView(VFSContainerView):
+ """Specific Package VFS view."""
+
+ __implments__ = VFSContainerView.__implements__
+
+ _directory_type = 'Package'
=== Zope3/src/zope/app/vfs/services/service.py 1.1 => 1.2 ===
--- /dev/null Wed Dec 25 09:14:00 2002
+++ Zope3/src/zope/app/vfs/services/service.py Wed Dec 25 09:13:30 2002
@@ -0,0 +1,80 @@
+##############################################################################
+#
+# Copyright (c) 2001, 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.
+#
+##############################################################################
+"""VFS-View for IServiceManager
+
+$Id$
+"""
+import datetime
+zerotime = datetime.datetime.fromtimestamp(0)
+
+from zope.publisher.vfs import VFSView
+from zope.publisher.interfaces.vfs import \
+ IVFSDirectoryPublisher
+
+class ServiceManagerView(VFSView):
+ """Specific ServiceManager VFS view."""
+
+ __implments__ = IVFSDirectoryPublisher, VFSView.__implements__
+
+ def exists(self, name):
+ 'See IVFSDirectoryPublisher'
+ if name == 'Packages':
+ return True
+ return False
+
+ def listdir(self, with_stats=0, pattern='*'):
+ 'See IVFSDirectoryPublisher'
+ return [('Packages', (16384+511, 0, 0, 0, "nouser", "nogroup", 0,
+ zerotime, zerotime, zerotime)) ]
+
+ def mkdir(self, name, mode=777):
+ 'See IVFSDirectoryPublisher'
+ pass
+
+ def remove(self, name):
+ 'See IVFSDirectoryPublisher'
+ pass
+
+ def rmdir(self, name):
+ 'See IVFSDirectoryPublisher'
+ pass
+
+ def rename(self, old, new):
+ 'See IVFSDirectoryPublisher'
+ pass
+
+ def writefile(self, name, mode, instream, start=0):
+ 'See IVFSDirectoryPublisher'
+ pass
+
+ def check_writable(self, name):
+ 'See IVFSDirectoryPublisher'
+ return False
+
+ def isdir(self):
+ 'See IVFSObjectPublisher'
+ return True
+
+ def isfile(self):
+ 'See IVFSObjectPublisher'
+ return False
+
+ def stat(self):
+ 'See IVFSObjectPublisher'
+ return (16384+511, 0, 0, 0, "nouser", "nogroup", 4096,
+ zerotime, zerotime, zerotime)
+
+ def publishTraverse(self, request, name):
+ 'See IVFSPublisher'
+ return None
=== Zope3/src/zope/app/vfs/services/zpt.py 1.1 => 1.2 ===
--- /dev/null Wed Dec 25 09:14:00 2002
+++ Zope3/src/zope/app/vfs/services/zpt.py Wed Dec 25 09:13:30 2002
@@ -0,0 +1,59 @@
+##############################################################################
+#
+# 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.
+#
+##############################################################################
+"""VFS ZPTTemplate Add View
+
+$Id$
+"""
+from zope.publisher.vfs import VFSView
+
+from zope.event import publish
+from zope.app.event.objectevent import ObjectCreatedEvent
+
+from zope.app.interfaces.services.package import IPackageAdding
+from zope.app.services.zpt import ZPTTemplate
+
+
+class ZPTTemplateAdd(VFSView):
+ "Provide a user interface for adding a ZPTTemplate content object"
+
+ __used_for__ = IPackageAdding
+
+ def __call__(self, mode, instream, start):
+ content = ZPTTemplate()
+ try:
+ instream.seek(start)
+ except:
+ pass
+ content.source = unicode(instream.read())
+
+ publish(self.context, ObjectCreatedEvent(content))
+ return self.context.add(content)
+
+
+
+"""VFS-View for IZPTTemplate
+
+VFS-view implementation for a ZPT Template.
+
+$Id$
+"""
+from zope.publisher.vfs import VFSFileView
+
+class ZPTTemplateView(VFSFileView):
+
+ def _setData(self, data):
+ self.context.source = data
+
+ def _getData(self):
+ return self.context.source