[Zope-Checkins] CVS: Zope3/lib/python/Zope/App/OFS/Container/Views/VFS - VFSContainerView.py:1.1.2.1
Stephan Richter
srichter@cbu.edu
Tue, 9 Apr 2002 13:02:57 -0400
Update of /cvs-repository/Zope3/lib/python/Zope/App/OFS/Container/Views/VFS
In directory cvs.zope.org:/tmp/cvs-serv19629/App/OFS/Container/Views/VFS
Added Files:
Tag: Zope3-Server-Branch
VFSContainerView.py
Log Message:
Hihi, without these files my checkins won't make much sense. :)
=== Added File Zope3/lib/python/Zope/App/OFS/Container/Views/VFS/VFSContainerView.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.
#
##############################################################################
"""
$Id: VFSContainerView.py,v 1.1.2.1 2002/04/09 17:02:56 srichter Exp $
"""
import fnmatch
from Zope.Publisher.VFS.IVFSDirectoryPublisher import IVFSDirectoryPublisher
class VFSContainerView:
__implements__ = IVFSDirectoryPublisher
def __init__(self, context):
""" """
self._container = context
############################################################
# Implementation methods for interface
# Zope.Publisher.VFS.IVFSDirectoryPublisher
def exists(self, name):
'See Zope.Publisher.VFS.IVFSDirectoryPublisher.IVFSDirectoryPublisher'
return self._container.hasObject(name)
def listdir(self, with_stats=0, pattern='*'):
'See Zope.Publisher.VFS.IVFSDirectoryPublisher.IVFSDirectoryPublisher'
ld = self._container.objectIds()
# filter them using the pattern
ld = filter(lambda f, p=pattern, fnm=fnmatch.fnmatch: fnm(f, p), ld)
# sort them alphabetically
ld.sort()
if not with_stats:
result = ld
else:
result = []
for file in ld:
stat = (16893, 0, 0, 0, 0, 0, 0, 0, 0, 0)
if stat is not None:
result.append((file, stat))
return result
def mkdir(self, name, mode=777):
'See Zope.Publisher.VFS.IVFSDirectoryPublisher.IVFSDirectoryPublisher'
pass
def remove(self, name):
'See Zope.Publisher.VFS.IVFSDirectoryPublisher.IVFSDirectoryPublisher'
return self._container.delObject(name)
def rmdir(self, name):
'See Zope.Publisher.VFS.IVFSDirectoryPublisher.IVFSDirectoryPublisher'
return self._container.delObject(name)
def rename(self, old, new):
'See Zope.Publisher.VFS.IVFSDirectoryPublisher.IVFSDirectoryPublisher'
obj = self._container.getObject(old)
self._container.delObject(old)
self._container.setObject(new, obj)
######################################
# from: Zope.Publisher.VFS.IVFSObjectPublisher.IVFSObjectPublisher
def isdir(self):
'See Zope.Publisher.VFS.IVFSObjectPublisher.IVFSObjectPublisher'
return 1
def isfile(self):
'See Zope.Publisher.VFS.IVFSObjectPublisher.IVFSObjectPublisher'
return 0
def stat(self):
'See Zope.Publisher.VFS.IVFSObjectPublisher.IVFSObjectPublisher'
return (16893, 0, 0, 0, 0, 0, 0, 0, 0, 0)
######################################
# from: Zope.Publisher.VFS.IVFSPublisher.IVFSPublisher
def publishTraverse(self, request, name):
'See Zope.Publisher.VFS.IVFSPublisher.IVFSPublisher'
return getattr(self, name)
#
############################################################
def getContext(self):
""" """
return self._container