I decided to store the DB in an external file, called files.txt in
JSON format.

import json
import os
from ftplib import FTP

ftp = FTP('host.ru')   # connect to host, default port
ftp.login('user', 'pass')

for file in files:
    n = len(file)
    if n < 3:
        file.append(-1)


    time = os.path.getmtime(file[0])
    if time != file[2]:
        file[2] = time
        FH = open(file[0],"rb")
        ftp.storbinary('STOR ' + file[1], FH)
        FH.close()

ftp.quit()
FH = open('./files.txt', 'w')
json.dump(files, FH)
FH.close()
g.es("Upload complete")

--------------------------------------------------------------------------
I wrote the module in leo - does anybody know, how to attach the file
here? And is it possible to store files.txt contents inside a leo
node, so I won't need to have a separate file with each leo file?
--------------------------------------------------------------------------
files.txt:

[
['d:/www/dubai/modules/file1.pm', 'host.ru/cgi-bin/modules/file1.pm',
1287345652.84375],
['d:/www/dubai/modules/file2.pm', 'host.ru/cgi-bin/modules/file2.pm',
1287392182.886375],
]

-- 
You received this message because you are subscribed to the Google Groups 
"leo-editor" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/leo-editor?hl=en.

Reply via email to