[Zope-Checkins] CVS: Zope3/lib/python/Zope/Publisher/VFS - IVFSCredentials.py:1.1.2.1 IVFSDirectoryPublisher.py:1.1.2.3 VFSRequest.py:1.1.2.3
Stephan Richter
srichter@cbu.edu
Wed, 10 Apr 2002 05:31:27 -0400
Update of /cvs-repository/Zope3/lib/python/Zope/Publisher/VFS
In directory cvs.zope.org:/tmp/cvs-serv23463/lib/python/Zope/Publisher/VFS
Modified Files:
Tag: Zope3-Server-Branch
IVFSDirectoryPublisher.py VFSRequest.py
Added Files:
Tag: Zope3-Server-Branch
IVFSCredentials.py
Log Message:
Okay, it finally works! We have a Publisher FTP server again. All the basic
functionalitry is there, from dir listing, file transfer to security.
I punted for now on recognizing file endings, since Jim wants to write a
proposal for that next week. Also, I did not solve the statistical file
information problem, since this takes some more research.
=== Added File Zope3/lib/python/Zope/Publisher/VFS/IVFSCredentials.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: IVFSCredentials.py,v 1.1.2.1 2002/04/10 09:30:54 srichter Exp $
"""
from Interface import Interface
class IVFSCredentials(Interface):
# XXX Eventially this will be a different method
def _authUserPW():
"""Return (login, password) if there are basic credentials;
return None if there aren't."""
def unauthorized(challenge):
"""Issue a 401 Unauthorized error (asking for login/password).
The challenge is the value of the WWW-Authenticate header."""
=== Zope3/lib/python/Zope/Publisher/VFS/IVFSDirectoryPublisher.py 1.1.2.2 => 1.1.2.3 ===
"""Rename an object from old name to new name.
"""
+
+ def writefile(name, mode, instream, start=0):
+ """Write a file to the container. If the object does not exist,
+ inspect the content and the file name to create the right object
+ type.
+ """
=== Zope3/lib/python/Zope/Publisher/VFS/VFSRequest.py 1.1.2.2 => 1.1.2.3 ===
from Zope.Publisher.BaseRequest import BaseRequest
from IVFSPublisher import IVFSPublisher
+from IVFSCredentials import IVFSCredentials
from VFSResponse import VFSResponse
class VFSRequest(BaseRequest):
- __implements__ = BaseRequest.__implements__
+ __implements__ = BaseRequest.__implements__, IVFSCredentials
# _viewtype is overridden from the BaseRequest
# to implement IVFSPublisher
@@ -43,6 +44,21 @@
"""Create a specific XML-RPC response object."""
return VFSResponse(outstream)
+
+ ############################################################
+ # Implementation methods for interface
+ # Zope.Publisher.VFS.IVFSCredentials.
+
+ def _authUserPW(self):
+ 'See Zope.Publisher.VFS.IVFSCredentials.IVFSCredentials'
+ env = self._environ
+ return env['username'], env['password']
+
+ def unauthorized(self, challenge):
+ 'See Zope.Publisher.VFS.IVFSCredentials.IVFSCredentials'
+ pass
+ #
+ ############################################################
######################################
# from: Zope.Publisher.IPublisherRequest.IPublisherRequest