[Zope3-checkins] CVS: Zope3/lib/python/Zope/App/OFS/Services/ServiceManager/VFS - PackageAdd.py:1.1 PackageAdding.py:1.1 PackageView.py:1.1 PackagesView.py:1.1 ServiceManagerView.py:1.1 __init__.py:1.1 configure.zcml:1.1
Stephan Richter
srichter@cbu.edu
Mon, 23 Dec 2002 03:15:39 -0500
Update of /cvs-repository/Zope3/lib/python/Zope/App/OFS/Services/ServiceManager/VFS
In directory cvs.zope.org:/tmp/cvs-serv26132/Zope/App/OFS/Services/ServiceManager/VFS
Added Files:
PackageAdd.py PackageAdding.py PackageView.py PackagesView.py
ServiceManagerView.py __init__.py configure.zcml
Log Message:
Implemented VFS views for the Local Service Manager. You can now traverse
into it up to Packages.
Since Jim did not tell me what he wanted to do in a Package, I did not
add much there, so that all Services are shown as directories now. The
only binding I implemented was for the ZPTTemplate, which works fine so
that you can add ZPTs via VFS now. I could imagine doing the same for
Module, but other than that Package is rather boring from a VFS point of
view.
Of course we could do some "magic" and display a text (file content)
representation of the various services, but I do not know how useful this
would be.
=== Added File Zope3/lib/python/Zope/App/OFS/Services/ServiceManager/VFS/PackageAdd.py ===
##############################################################################
#
# 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: PackageAdd.py,v 1.1 2002/12/23 08:15:38 srichter Exp $
"""
from Zope.Publisher.VFS.VFSView import VFSView
from Zope.Event import publish
from Zope.App.Event.ObjectEvent import ObjectCreatedEvent
from Zope.App.OFS.Container.IAdding import IAdding
from Zope.App.OFS.Services.ServiceManager.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)
=== Added File Zope3/lib/python/Zope/App/OFS/Services/ServiceManager/VFS/PackageAdding.py ===
##############################################################################
#
# 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.
#
##############################################################################
"""Adding View for IPackage
$Id: PackageAdding.py,v 1.1 2002/12/23 08:15:38 srichter Exp $
"""
from Zope.Publisher.VFS.VFSView import VFSView
from Zope.App.OFS.Container.Views.VFS.Adding import Adding
from Zope.App.OFS.Services.ServiceManager.IPackageAdding import IPackageAdding
class PackageAdding(Adding):
__implements__ = IPackageAdding, VFSView.__implements__
=== Added File Zope3/lib/python/Zope/App/OFS/Services/ServiceManager/VFS/PackageView.py ===
##############################################################################
#
# 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 IPackage
$Id: PackageView.py,v 1.1 2002/12/23 08:15:38 srichter Exp $
"""
import datetime
zerotime = datetime.datetime.fromtimestamp(0)
from Zope.ComponentArchitecture import getAdapter
from Zope.App.DublinCore.IZopeDublinCore import IZopeDublinCore
from Zope.App.OFS.Container.Views.VFS.VFSContainerView import \
VFSContainerView
class PackageView(VFSContainerView):
"""Specific Package VFS view."""
__implments__ = VFSContainerView.__implements__
_directory_type = 'Package'
=== Added File Zope3/lib/python/Zope/App/OFS/Services/ServiceManager/VFS/PackagesView.py ===
##############################################################################
#
# 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 IPackages
$Id: PackagesView.py,v 1.1 2002/12/23 08:15:38 srichter Exp $
"""
import datetime
zerotime = datetime.datetime.fromtimestamp(0)
from Zope.ComponentArchitecture import getAdapter
from Zope.App.DublinCore.IZopeDublinCore import IZopeDublinCore
from Zope.App.OFS.Container.Views.VFS.VFSContainerView import \
VFSContainerView
class PackagesView(VFSContainerView):
"""Specific Packages VFS view."""
__implments__ = VFSContainerView.__implements__
_directory_type = 'Package'
def remove(self, name):
'See Zope.Publisher.VFS.IVFSDirectoryPublisher.IVFSDirectoryPublisher'
pass # not applicable
def writefile(self, name, mode, instream, start=0):
'See Zope.Publisher.VFS.IVFSDirectoryPublisher.IVFSDirectoryPublisher'
pass # not applicable
=== Added File Zope3/lib/python/Zope/App/OFS/Services/ServiceManager/VFS/ServiceManagerView.py ===
##############################################################################
#
# 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: ServiceManagerView.py,v 1.1 2002/12/23 08:15:38 srichter Exp $
"""
import datetime
zerotime = datetime.datetime.fromtimestamp(0)
from Zope.Publisher.VFS.VFSView import VFSView
from Zope.Publisher.VFS.IVFSDirectoryPublisher import \
IVFSDirectoryPublisher
class ServiceManagerView(VFSView):
"""Specific ServiceManager VFS view."""
__implments__ = IVFSDirectoryPublisher, VFSView.__implements__
############################################################
# Implementation methods for interface
# Zope.Publisher.VFS.IVFSDirectoryPublisher
def exists(self, name):
'See Zope.Publisher.VFS.IVFSDirectoryPublisher.IVFSDirectoryPublisher'
if name == 'Packages':
return True
return False
def listdir(self, with_stats=0, pattern='*'):
'See Zope.Publisher.VFS.IVFSDirectoryPublisher.IVFSDirectoryPublisher'
return [('Packages', (16384+511, 0, 0, 0, "nouser", "nogroup", 0,
zerotime, zerotime, zerotime)) ]
def mkdir(self, name, mode=777):
'See Zope.Publisher.VFS.IVFSDirectoryPublisher.IVFSDirectoryPublisher'
pass
def remove(self, name):
'See Zope.Publisher.VFS.IVFSDirectoryPublisher.IVFSDirectoryPublisher'
pass
def rmdir(self, name):
'See Zope.Publisher.VFS.IVFSDirectoryPublisher.IVFSDirectoryPublisher'
pass
def rename(self, old, new):
'See Zope.Publisher.VFS.IVFSDirectoryPublisher.IVFSDirectoryPublisher'
pass
def writefile(self, name, mode, instream, start=0):
'See Zope.Publisher.VFS.IVFSDirectoryPublisher.IVFSDirectoryPublisher'
pass
def check_writable(self, name):
'See Zope.Publisher.VFS.IVFSDirectoryPublisher.IVFSDirectoryPublisher'
return False
######################################
# from: Zope.Publisher.VFS.IVFSObjectPublisher.IVFSObjectPublisher
def isdir(self):
'See Zope.Publisher.VFS.IVFSObjectPublisher.IVFSObjectPublisher'
return True
def isfile(self):
'See Zope.Publisher.VFS.IVFSObjectPublisher.IVFSObjectPublisher'
return False
def stat(self):
'See Zope.Publisher.VFS.IVFSObjectPublisher.IVFSObjectPublisher'
return (16384+511, 0, 0, 0, "nouser", "nogroup", 4096,
zerotime, zerotime, zerotime)
######################################
# from: Zope.Publisher.VFS.IVFSPublisher.IVFSPublisher
def publishTraverse(self, request, name):
'See Zope.Publisher.VFS.IVFSPublisher.IVFSPublisher'
return None
#
############################################################
=== Added File Zope3/lib/python/Zope/App/OFS/Services/ServiceManager/VFS/__init__.py ===
=== Added File Zope3/lib/python/Zope/App/OFS/Services/ServiceManager/VFS/configure.zcml ===
<zopeConfigure
xmlns="http://namespaces.zope.org/zope"
xmlns:vfs="http://namespaces.zope.org/vfs"
>
<!-- Note that we have to use another Adding interface here, since
it conflicts otherwise with the content namespace definitions. -->
<vfs:view
for="Zope.App.OFS.Services.ServiceManager.IPackage."
name="+"
factory=".PackageAdding."
allowed_attributes="setContentName add"
permission="Zope.ManageContent" />
<vfs:view
for="Zope.App.OFS.Container.IContainer."
name="+"
factory="Zope.App.OFS.Container.Views.VFS.Adding."
allowed_attributes="setContentName add"
permission="Zope.ManageContent" />
<vfs:view
name="Package"
for="Zope.App.OFS.Container.IAdding."
factory=".PackageAdd."
permission="Zope.ManageContent" />
<vfs:view
name="vfs"
for="Zope.App.OFS.Services.ServiceManager.IServiceManager."
permission="Zope.ManageContent"
allowed_interface="Zope.Publisher.VFS.IVFSDirectoryPublisher."
factory=".ServiceManagerView."
/>
<vfs:view
name="vfs"
for="Zope.App.OFS.Services.ServiceManager.IPackages."
permission="Zope.ManageContent"
allowed_interface="Zope.Publisher.VFS.IVFSDirectoryPublisher."
factory=".PackagesView."
/>
<vfs:view
name="vfs"
for="Zope.App.OFS.Services.ServiceManager.IPackage."
permission="Zope.ManageContent"
allowed_interface="Zope.Publisher.VFS.IVFSDirectoryPublisher."
factory=".PackageView."
/>
</zopeConfigure>