Am Donnerstag, den 08.03.2007, 00:32 +0100 schrieb Wichert Akkerman:
> Previously Christian Theune wrote:
> > Am Mittwoch, den 07.03.2007, 21:31 +0100 schrieb Uwe Oestermeier:
> > > Christian Theune <[EMAIL PROTECTED]> schreibt:
> > > >
> > > >Nope. It won't disappear if you link it again. And the link(src, dst)
> > > >does move it to a 'save' location ;)
> > >
> > > Again I'm not convinced because you cannot be sure that no other process
> > > deletes the temp file.
> > > In the following I simulate this with a os.system call:
> > >
> > > >>> import tempfile, os
> > > >>> d = tempfile.NamedTemporaryFile()
> > > >>> os.path.exists(d.name)
> > > True
> > > >>> d.write('Test')
> > > >>> os.path.exists('/tmp/asdf')
> > > False
> > > >>> os.link(d.name, '/tmp/asdf')
> > > >>> d.close()
> > > >>> os.system('rm /tmp/asdf')
> > > 0
> > > >>> os.path.exists('/tmp/asdf')
> > > False
> > > >>> open('/tmp/asdf').read()
> > > Traceback (most recent call last):
> > > File "<stdin>", line 1, in ?
> > > IOError: [Errno 2] No such file or directory: '/tmp/asdf'
> >
> > 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.
> >
> > The link operation *is* the rename except that now two files link to it.
> > This keeps the semantics of a NamedTemporaryFile in respect to the
> > request processing and the publisher intact.
>
> Two possible things come to mind:
> - if the tempfile is on a different filesystem you can not link the file
> elsehere. Can we guarantee that they will be on the same filesystem?
> - does this work on non-posix systems such as windows?
>
> Wichert.Please have a look at http://wiki.zope.org/ZODB/BlobsZeroCopy before continuing this thread. -- 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
signature.asc
Description: Dies ist ein digital signierter Nachrichtenteil
_______________________________________________ Zope3-dev mailing list [email protected] Unsub: http://mail.zope.org/mailman/options/zope3-dev/archive%40mail-archive.com
