/usr/share/pyshared/zope/publisher/ftp.py is in python-zope.publisher 3.12.6-2ubuntu1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 | ##############################################################################
#
# Copyright (c) 2001, 2002 Zope Foundation and Contributors.
# All Rights Reserved.
#
# This software is subject to the provisions of the Zope Public License,
# Version 2.1 (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
#
##############################################################################
"""FTP Publisher
"""
from zope.interface import implements
from zope.publisher.interfaces.ftp import IFTPCredentials, IFTPRequest
from zope.publisher.base import BaseResponse, BaseRequest
class FTPResponse(BaseResponse):
__slots__ = '_exc', # Saved exception
def outputBody(self):
# Nothing to do
pass
def getResult(self):
if getattr(self, '_exc', None) is not None:
raise self._exc[0], self._exc[1], self._exc[2]
return self._result
def handleException(self, exc_info):
self._exc = exc_info
class FTPRequest(BaseRequest):
implements(IFTPCredentials, IFTPRequest)
__slots__ = '_auth'
def __init__(self, body_instream, environ, response=None):
self._auth = environ.get('credentials')
del environ['credentials']
super(FTPRequest, self).__init__(body_instream, environ, response)
path = environ['path']
if path.startswith('/'):
path = path[1:]
if path:
path = path.split('/')
path.reverse()
self.setTraversalStack(path)
def _createResponse(self):
"""Create a specific FTP response object."""
return FTPResponse()
def _authUserPW(self):
'See IFTPCredentials'
return self._auth
def unauthorized(self, challenge):
'See IFTPCredentials'
# BBB
try:
from zope.login.ftp import FTPAuth
except ImportError:
pass
|