Am Mittwoch, den 07.03.2007, 22:04 +0100 schrieb Uwe Oestermeier:
> Christian Theune <[EMAIL PROTECTED]> schreibt:
> >Nope this is not the correct simulation. Who except your application
> >knows about /tmp/asdf? You have to simulate deleting d.name and then
> >you'll see that /tmp/asdf does not disappear.
> 
> Ok, but what Dieter means is that the tmp dir as a whole is emptied from
> time to time.


> I see your point that closing a temp file removes it whereas the link
> still works,
> but that does not solve the problem that system administrators may sweep
> things out.

It does because we do need tmp partition to be the same as the blob
partition. 

> The following solution avoids this problem:
> 
> >>> os.mkdir('/Users/uo/blobs')
> >>> d = tempfile.NamedTemporaryFile()
> >>> d.write('Test')
> >>> d.flush()
> >>> os.rename(d.name, '/Users/uo/blobs/asdf')
> >>> open('/Users/uo/blobs/asdf').read()
> 'Test'
> >>> os.path.exists('/tmp/asdf')
> False

This won't work because if it's not the same partition (which you imply
is needed because the tmp-partition might be cleared out by admins) then
rename isn't available.

This also doesn't work on windows as an opened file can not be renamed
on windows.

Again, another pointer to move this dicussion to zodb-dev.

Christian

-- 
gocept gmbh & co. kg - forsterstra├če 29 - 06112 halle/saale - germany
www.gocept.com - [EMAIL PROTECTED] - phone +49 345 122 9889 7 -
fax +49 345 122 9889 1 - zope and plone consulting and development

Attachment: signature.asc
Description: Dies ist ein digital signierter Nachrichtenteil

_______________________________________________
Zope3-dev mailing list
Zope3-dev@zope.org
Unsub: http://mail.zope.org/mailman/options/zope3-dev/archive%40mail-archive.com

Reply via email to