[Zope-Checkins] CVS: Zope3/lib/python/Zope/Publisher/VFS - IVFSDirectoryPublisher.py:1.1.2.2 IVFSFilePublisher.py:1.1.2.2 IVFSObjectPublisher.py:1.1.2.2 VFSRequest.py:1.1.2.2 VFSResponse.py:1.1.2.2 metaConfigure.py:1.1.2.2
Stephan Richter
srichter@cbu.edu
Tue, 9 Apr 2002 12:12:32 -0400
Update of /cvs-repository/Zope3/lib/python/Zope/Publisher/VFS
In directory cvs.zope.org:/tmp/cvs-serv4334/Publisher/VFS
Modified Files:
Tag: Zope3-Server-Branch
IVFSDirectoryPublisher.py IVFSFilePublisher.py
IVFSObjectPublisher.py VFSRequest.py VFSResponse.py
metaConfigure.py
Log Message:
Check in my big mess of stuff, which is working towards making FTP work
together with the Publisher. I will keep working on startup now, so that
we can test easier.
This is basically a check-in, so that Shane can see what I have done last
night. Please do not expect anything towork, since this is more than just
work in progress... it is a prototype to get FTP running via Publisher!
=== Zope3/lib/python/Zope/Publisher/VFS/IVFSDirectoryPublisher.py 1.1.2.1 => 1.1.2.2 ===
from IVFSObjectPublisher import IVFSObjectPublisher
+
class IVFSDirectoryPublisher(IVFSObjectPublisher):
""" """
-
- def listdir():
- """Returns a sequence of names"""
+ def exists(name):
+ """Checks whether the name exists.
+ """
+
+ def listdir(with_stats=0, pattern='*'):
+ """Returns a sequence of names ot (name, stat)
+ """
+
+ def mkdir(name, mode=777):
+ """Create a container with name in this object.
+ """
def remove(name):
- """Removes a file"""
-
-
- def rename(oldname, newname):
- """Renames a file"""
-
+ """Remove file with naem from this container.
+ """
- def getfile(name):
- """Returns an existing IVFSObject"""
+ def rmdir(name):
+ """Remove the container name from this container.
+ """
+
+ def rename(old, new):
+ """Rename an object from old name to new name.
+ """
=== Zope3/lib/python/Zope/Publisher/VFS/IVFSFilePublisher.py 1.1.2.1 => 1.1.2.2 ===
class IVFSFilePublisher(IVFSObjectPublisher):
- """ """
+ """This interface describes the necessary methods a VFS view has to
+ implement in order to be used by teh VFS.
+ """
- def read():
- """Returns a string or a stream"""
+ def read(mode, outstream, start=0, end=-1):
+ """Read the content of this object.
+ """
+
+ def write(mode, instream, start=0):
+ """Write data specified in instream to object.
+ """
-
- def write(stream):
- """Writes the stream to this object"""
+ def check_writable(mode):
+ """Check whether we can write to this object.
+ """
=== Zope3/lib/python/Zope/Publisher/VFS/IVFSObjectPublisher.py 1.1.2.1 => 1.1.2.2 ===
""" """
+ def isdir():
+ """Returns true, if the object is a container, namely implements
+ IContainer. For all other cases it returns false.
+ """
+
+ def isfile():
+ """Returns always the oposite of isdir() for the same reasons.
+ """
+
def stat():
- """Similar to os.stat()"""
+ """This method should return the typical file stat information:
+ (mode, ino, dev, nlink, uid, gid, size, atime, mtime, ctime)
+ """
=== Zope3/lib/python/Zope/Publisher/VFS/VFSRequest.py 1.1.2.1 => 1.1.2.2 ===
self._environ = environ
+ self.method = ''
self.__setupPath()
@@ -50,14 +51,14 @@
'See Zope.Publisher.IPublisherRequest.IPublisherRequest'
if self._environ.has_key('command'):
- self.setPathSuffix((self._environ['command'],))
+ self.method = self._environ['command']
#
############################################################
def __setupPath(self):
- path = self.get('PATH_INFO', '/').strip()
+ path = self.get('path', '/').strip()
if path.endswith('/'):
path = path[:-1] # XXX Why? Not sure
@@ -82,3 +83,9 @@
self.setTraversalStack(clean)
self._path_suffix = None
+
+
+ def __repr__(self):
+ # Returns a *short* string.
+ return '<%s instance at 0x%x, path=%s>' % (
+ str(self.__class__), id(self), '/'.join(self._traversal_stack))
=== Zope3/lib/python/Zope/Publisher/VFS/VFSResponse.py 1.1.2.1 => 1.1.2.2 ===
+ def outputBody(self):
+ 'See Zope.Publisher.IPublisherResponse.IPublisherResponse'
+ pass
+
+
def getResult(self):
""" """
return self._getBody()
=== Zope3/lib/python/Zope/Publisher/VFS/metaConfigure.py 1.1.2.1 => 1.1.2.2 ===
$Id$
"""
-from Zope.ComponentArchitecture import setDefaultViewName
+from Zope.ComponentArchitecture import provideView, setDefaultViewName
from Zope.Configuration.Action import Action
from IVFSPublisher import IVFSPublisher
@@ -30,5 +30,10 @@
discriminator = ('defaultViewName', for_, name, IVFSPublisher),
callable = setDefaultViewName,
args = (for_, IVFSPublisher, name),
+ )
+ Action(
+ discriminator = ('view', for_, name, IVFSPublisher, layer),
+ callable = provideView,
+ args = (for_, name, IVFSPublisher, factory, layer),
)
]