[Zope] Batch importing stuff into Zope
Stephen Pitts
smpitts@midsouth.rr.com
Mon, 28 Feb 2000 21:05:15 -0600
I'm trying to batch-import about 300 JPEGs into Zope as instances of the Photo
product using the following python script:
from urllib import urlopen, urlencode
from sys import argv
from time import time
# first argument is name of folder within the Photos folder
url = "http://www.centralchurchyouth.org:8100/Photos/%s/manage_addProduct/Photo/manage_addPhoto" % argv[1]
# additional arguments are filenames
for filename in argv[2:]:
args = {}
args['file'] = open(filename).read()
args['id'] = filename
args['title'] = filename
args = urlencode(args)
beforeurlopen = time()
urlopen(url, args)
print filename, time() - beforeurlopen
The script works, but it takes an average of 30-40 seconds per JPEG.
I've got a fast connection to the server, and the JPEGS are 40-50 k
apiece. Uploading from the management interface takes 2-3 seconds.
Does anyone have any suggestions?
--
Stephen Pitts
smpitts@midsouth.rr.com