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 <[EMAIL PROTECTED]> * http://www.post1.com/home/ngps

Zope maillist  -  [EMAIL PROTECTED]
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://lists.zope.org/mailman/listinfo/zope-dev )

Reply via email to