Hi,
We are using Collaboration 8.0.2 (Python 2.2) and I've create a Dropbox-custom object where users upload zip-files which need to be extracted onto Collaboration to a designated location with a designated owner.
I've been doing it before using a Windows share and csv-file, so I *think* I already have most of the code and will be able to transform it rather quickly, but I'm blocked trying to grab a hold of the zip-objects...I have the KM-objects but would need to cast them as ZipFile or something in order to work with them as such.
The Dropbox is in essence a folder holding the uploaded files, and a first step would be to do a zipfile.is_zipfile(). However, I keep getting a NoneType when I do this... It should return true and, afterwards, I would like to cast it as a ZipFile and do a testzip(), then begin extracting/converting to KM-objects.
dropbox = kmSession.getKMObjectFromLogicalName('nirond_dropbox')
zips=pylist(dropbox.getChildren())
log("Zips found: " + str(len(zips)))
for zip in zips:
log(zip.getName() + " (" + str(zip.getSize()) + " bytes) is zipfile? " + str(zipfile.is_zipfile(zip.getContentStream())))
if(zipfile.is_zipfile(zip.getContentStream()) == True):#check if it's a valid zipfile, should be True (currently returning None)
log("This is a zipfile")
#cast as ZipFile and do a decent testzip()
zf = zipfile.ZipFile(zip,mode='w')#this is not the correct way to do it...
for name in zf.namelist():
log(name + " is in the zipfile")
else:
log("Not a zipfile")
Does anyone have an idea how to work with zipfiles in Collaboration using Python 2.2?
Thanks in advance.