[Zope-dev] FileUpload and blob on Windows

Christian Theune ct at gocept.com
Tue Jan 29 02:03:26 EST 2008


Hi,

Leonardo Rochael schrieb:
> I should've been clearer, I meant reading and writing at the same time from
> 2 different file handles. 
> 
> NamedTemporaryFile has the added complication of removing the file from
> under 'blob' when it's closed, so even if I don't try to open the blob after
> consuming the file, the file disappears after the request is gone, and the
> transaction subsequently fails when trying to rename the consumed file to
> it's final location.
> 
> I also tried win32file.CreateHardLink() but if a file is open by one
> hard-link, renaming the other hard-link fails, so we're stuck with copying
> files wholesale on Windows, or closing the FileUpload object and letting
> subsequent uses of it fail.

Hmm. The Python docs already mention this problem for Windows. To avoid 
copying, we'd have to adjust the publisher not to use a 
NamedTemporaryFile, but actually use a regular temporary file that gets 
deleted when the publisher decides to.

Christian

-- 
gocept gmbh & co. kg - forsterstrasse 29 - 06112 halle (saale) - germany
www.gocept.com - ct at gocept.com - phone +49 345 122 9889 7 -
fax +49 345 122 9889 1 - zope and plone consulting and development


More information about the Zope-Dev mailing list