[Zope] ftp connection to remote Zope-Server

vsbabu@vsbabu.org vsbabu@vsbabu.org
Tue, 12 Nov 2002 12:13:33 -0500


I must be stupid, but are you sure that your FTP port in remote machine is
21? Or is it 8021 as in a default Zope install?

S Babu
http://vsbabu.org/

On Tue, Nov 12, 2002 at 05:05:21PM +0100 or thereabouts, Elena Schulz wrote:
> Hi,
> 
> I want to connect my local Zope (win98, Zope 2.5.1) to a remote Zope-Server
> only by ftp-access.
> The following external method from zopelabs seems to connect somehow but
> doesn work (no files are sent):
> 
> 1. How can I log the info from the remote Server to see where the problem
> is?
> 2. Is "_ftp.set_pasv(1)" ok to enable passive mode for operating from behind
> a firewall?
> 
> Has anybody positive experience with this or other methods of ftp-connection
> between 2 Zope-server?
> Thanks for any help and replies,
> 
> Elena
> 
> The external-script:
> 
> """ sendfiles from ZOPE to another machine ftp
>  by runyaga @ zopelabs
> """
> 
> import ftplib
> from string import split, lower
> from StringIO import StringIO
> 
> host='localhost'
> login='runyaga'
> password='^%$^@5@#$S'
> port=21
> 
> def ftp(obj, host=host, login=login, password=password, port=port):
>     _ftp = ftplib.FTP()
>     _ftp.set_pasv(1)  #for firewall < ######## 2 ############
>     #_ftp.connect(host, port)
>     _ftp.connect(host) # with default port
>     _ftp.login(login, password)
> 
>     if lower(obj.meta_type)=='file':
>         binary=1
>         if obj.content_type[:4]=='text': binary=0
>         ftp_file(_ftp, obj, binary)
> 
>     if lower(obj.meta_type)=='image':
>         ftp_file(_ftp, obj, 1)
> 
>     _ftp.quit()
> 
> def ftp_file(ftpCon, fileObj, binary):
>     if binary:
>         ftpCon.storbinary("STOR " + fileObj.getId(), StringIO(fileObj.data),
> 1024)
>     else:
>         f = StringIO()
>         f.readlines(split(fileObj.data, '\n'))
>         f.seek(0)
>         ftpCon.storlines("STOR " + fileObj.getId(), f)
> 
> 
> _______________________________________________
> Zope maillist  -  Zope@zope.org
> http://lists.zope.org/mailman/listinfo/zope
> **   No cross posts or HTML encoding!  **
> (Related lists - 
>  http://lists.zope.org/mailman/listinfo/zope-announce
>  http://lists.zope.org/mailman/listinfo/zope-dev )