How to upload 900 files, in one shot ?
Hi, anyone here can help me with that problem below ? -----v
How I can upload 900 files inside Zope, if I want to be able to manage them by the Zope Interface, I cannot browse inside data.fs, and I cannot upload my 900 files by FTP ing them. Because the server cannot use the 8021 port. I cannot upload them with Itamar program -> LoadSite, because it's not working, windows close the program.
So do you know a way ? If not, it will take me 8 hours to upload all those files, inside the data.fs, one by one. It's a nice problems, I tryed to find a way since 3 days, now I ask the experts. It would be good for Zope, in the next version, to add a program, where we can upload many file in one shot/click.
-- Very truly yours,
<><><><><><><><><><><><><><> Jonathan Desp Atoma Matter will become Software http://www.atoma.f2s.com <><><><><><><><><><><><><><>
-- Very truly yours, <><><><><><><><><><><><><><> Jonathan Desp Atoma Matter will become Software http://www.atoma.f2s.com <><><><><><><><><><><><><><>
Jonathan Desp wrote:
Hi, anyone here can help me with that problem below ? -----v
How I can upload 900 files inside Zope, if I want to be able to manage them by the Zope Interface, I cannot browse inside data.fs, and I cannot upload my 900 files by FTP ing them. Because the server cannot use the 8021 port. I cannot upload them with Itamar program -> LoadSite, because it's not working, windows close the program.
Um, perhaps a stupid question, but can it use other ports for ftp and/or can you reach the server? If so, you can easily change the ftp port in the z2.py program in your zoperoot (it's heavily annotated, so that shouldn't be a problem). As to loadsite, is there an error message (or a traceback) with which it closes loadsite? If the window closes too fast you may need to run it from a dos window. WIth <zoperoot>\bin\python <path_to_loadsite>\loadsite.py (arguments) hth Rik
On Fri, Jun 30, 2000 at 03:05:49AM -0400, Jonathan Desp wrote:
How I can upload 900 files inside Zope, if I want to be able to manage them by the Zope Interface,
Using so-called "Internet programming". ;-) If you 'view frame source' when creating a Zope File object, you'll see that '<form action="manage_addFile" method="post" ...>', with parameters 'id', 'title' and 'file'. This means you can talk to it via http post. Executable pseudo-code <0.5 wink> follows: import urllib user = 'zope_user' passwd = 'zope_pass' folder = '/path/to/my/folder' action = '/manage_addFile' url = 'http://%s:%s@myzope:8080%s%s' % (user, passwd, folder, action) for fname in my_900_file_list: dict = {'id':fname, 'title':fname, 'file':fname} postdata = urllib.urlencode(dict) u = urllib.urlopen(url, postdata) The very act of "u = urllib.urlopen(...)" will create a Zope File object with id and title set to the filename. You don't have to do anything with "u", just loop around. Indeed, if you try, say, u.read(), Zope will prompt you for username and password. You'll probably need to make your filenames legal Zope identifiers, e.g., by stripping path separators. clicking-and-drooling-over-900-entries-is-sure-fun-ly y'rs -- Ng Pheng Siong <ngps@post1.com> * http://www.post1.com/home/ngps
participants (3)
-
Jonathan Desp -
Ng Pheng Siong -
Rik Hoekstra