Re: [Zope-dev] FileUpload and blob on Windows

2008-01-30 Thread Dieter Maurer
Leonardo Rochael wrote at 2008-1-27 22:29 -0800: > ... >Closing the NamedTemporaryFile after consuming it and before opening the >blob makes the matters worse, since Windows removes the file from under Blob >*after* it has been consumed, so we'll have to think of a different strategy >for consuming

AW: AW: [Zope-dev] FileUpload and blob on Windows

2008-01-29 Thread Roger Ineichen
hi Leo > Betreff: Re: AW: [Zope-dev] FileUpload and blob on Windows [...] > I'm already using something like that, because > NamedTemporaryFiles on Windows disappear when they're closed, > *even if* they've been renamed away from the original file > name, bu

Re: AW: [Zope-dev] FileUpload and blob on Windows

2008-01-29 Thread Christian Theune
Hi, Leonardo Rochael schrieb: If only there was a flag so that Windows allowed renaming/removing an open file, but didn't try to remove the file itself after it was closed... Actually looking at the restrictions that hard links have on windows, I guess that windows removes the equivalent of t

Re: AW: [Zope-dev] FileUpload and blob on Windows

2008-01-29 Thread Leonardo Rochael
Roger Ineichen wrote: > > Why are you using a NamedTemporaryFile? If I'm right the > goal is to store the file stream from the upload directly > in this file and copy this file over to the real directory > location. > This means you can cut down the amount of read and write file data, right? >

Re: [Zope-dev] FileUpload and blob on Windows

2008-01-28 Thread Christian Theune
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 th

AW: [Zope-dev] FileUpload and blob on Windows

2008-01-28 Thread Roger Ineichen
Hi > Betreff: RE: [Zope-dev] FileUpload and blob on Windows > > > Hi Mark, > > > Mark Hammond-3 wrote: > > > > [...] > >> unless we use some non-portable win32 code to allow writing and > >> reading to the same file simultaneou

RE: [Zope-dev] FileUpload and blob on Windows

2008-01-28 Thread Leonardo Rochael
Hi Mark, Mark Hammond-3 wrote: > > [...] >> unless we use some non-portable win32 code to allow writing and >> reading to the same file simultaneously. > > I'm not sure exactly what you mean by "simultaneously", but assuming you > just need the ability to read and write to a file, you already

RE: [Zope-dev] FileUpload and blob on Windows

2008-01-28 Thread Mark Hammond
Hi Leo, I'm not familiar with the Zope side of the world at all, so this may be completely useless... > However, if one tries to consume a NamedTemporaryFile and then open its > generated blob before closing the tempfile, Windows complains: > > > > import ZODB.blob, tempfile > f = t

[Zope-dev] FileUpload and blob on Windows

2008-01-27 Thread Leonardo Rochael
Hi all, ZODB.blob.Blob.consumeFile() needs a real, existing filesystem location passed into it to work, which is why plone.app.blob[1] patches ZPublisher.HTTPRequest.FieldStorage to generate a tempfile.NamedTemporaryFile() instead of a tempfile.TemporaryFile() for large uploaded files. However,