Skip to content

Commit

Permalink
No new functionality - just merge the sftp package into the ftp direc…
Browse files Browse the repository at this point in the history
…tory.
  • Loading branch information
mkerrin committed May 15, 2005
1 parent 1e2411e commit 49ece0a
Show file tree
Hide file tree
Showing 8 changed files with 30 additions and 66 deletions.
8 changes: 1 addition & 7 deletions configure.zcml
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,6 @@
provides=".interfaces.IServerType"
/>

<utility
name="FTP"
component=".ftp.ftpserver"
provides=".interfaces.IServerType"
/>

<include package=".sftp" />
<include package=".ftp" />

</configure>
17 changes: 16 additions & 1 deletion ftp/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,14 @@
# FOR A PARTICULAR PURPOSE.
#
##############################################################################
"""FTP server factories.
"""FTP and SFTP server factories.
"""

from zope.app.server.utils import FTPRequestFactory
from zope.app.server.server import ServerType
from zope.app.server.ftp.server import FTPFactory
from zope.app.server.server import SSHServerType
from sftpserver import SFTPFactory

def createFTPFactory(db):
request_factory = FTPRequestFactory(db)
Expand All @@ -26,3 +28,16 @@ def createFTPFactory(db):
return factory

ftpserver = ServerType(createFTPFactory, 8021)


def createSFTPFactory(db, hostkey):
"""
Note that all SSH factories must contain the extra hostkey arguement.
"""
request_factory = FTPRequestFactory(db)

factory = SFTPFactory(request_factory, hostkey = hostkey)

return factory

sftpserver = SSHServerType(createSFTPFactory, 8115)
7 changes: 6 additions & 1 deletion sftp/configure.zcml → ftp/configure.zcml
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,14 @@
provides="..interfaces.IServerType"
/>

<utility
name="FTP"
component=".ftpserver"
provides="..interfaces.IServerType"/>

<adapter
factory=".sftp.SFTPServerForZope"
for=".server.ZopeAvatar"
for=".sftpserver.ZopeAvatar"
provides="twisted.conch.ssh.filetransfer.ISFTPServer"
/>

Expand Down
File renamed without changes.
11 changes: 7 additions & 4 deletions sftp/server.py → ftp/sftpserver.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,12 @@
from twisted.conch.ssh.keys import getPublicKeyString, \
getPrivateKeyObject, objectType
except ImportError, e:
SSHFactory = object
SSHFactory = object # so we can create the SFTPFactory
class SSHFactory(object):
def doStart(self):
raise ImportError, \
"Please install pycrypto to run the SFTP server."
SSHUserAuthServer = None
getPublicKeyString = getPrivateKeyObject = objectType = None
from twisted.conch.avatar import ConchUser
from twisted.conch.interfaces import IConchUser

Expand Down Expand Up @@ -164,8 +167,8 @@ def __init__(self, request_factory, hostkey):
<type 'tuple'>
>>> db.close()
The result variable should be the return value of the 'requestAvatar' method
of the SFTPRealm method. This method contains its own test.
The result variable should be the return value of the 'requestAvatar'
method of the SFTPRealm method. This method contains its own test.
"""
self.hostkey = hostkey

Expand Down
37 changes: 0 additions & 37 deletions sftp/__init__.py

This file was deleted.

1 change: 0 additions & 1 deletion sftp/tests/__init__.py

This file was deleted.

15 changes: 0 additions & 15 deletions sftp/tests/tests_sftpserver.py

This file was deleted.

0 comments on commit 49ece0a

Please sign in to comment.