Home

fighting plone.app.blob

Updated:
Created:

With out current intranet application we have drag and drop for files in firefox. Works nicely for one file, but if I drag 20 or more in, there are two main problems: ConflictError and POSKeyError. The former is quite understandable - 20 concurrent write requests on the same object could cause that. The POSKeyError however signals "POSKeyError("No blob file", oid, serial)" . But I have uploaded the blob. And no matter what I try, I can't force it to be written.

Or can I? I needed to pass a StringIO instance to the BlobField.set (so that I can pass on the filename), and it turns out that this StringIO is adapted to IBlobbable using plone.app.blob.adapters.stringio.BlobbableStringIO. And there, in feed, they write to blob.open('w'), but never close it.

Changing it to

 def feed(self, blob):
        """ see interface ... """
        pos = self.context.tell()
        self.context.seek(0)
        bfile = blob.open('w')
        bfile.writelines(self.context)
        bfile.close()
        self.context.seek(pos)

seems to help a lot - at least now I can't reproduce the POSKeyError anymore.

Maybe I need to post a bug report?

Done: http://plone.org/products/plone.app.blob/issues/43