[Zope3-dev] Proposal for optimized Blob handling

Christian Theune ct at gocept.com
Wed Mar 7 15:17:58 EST 2007


Am Mittwoch, den 07.03.2007, 21:12 +0100 schrieb Uwe Oestermeier:
> Christian Theune <ct at gocept.com> schreibt:
> >This is how the dance looks like to do the link():
> >
> > >>> 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.path.exists(d.name)
> > False
> > >>> os.path.exists('/tmp/asdf')
> > True
> > >>> open('/tmp/asdf').read()
> > 'Test'
> 
> Yeah, but as Dieter said the temp file should be better renamed or moved
> to a save location.
> It is likely that a temp file disappears.

Nope. It won't disappear if you link it again. And the link(src, dst)
does move it to a 'save' location ;)

Christian

-- 
gocept gmbh & co. kg - forsterstraße 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
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Dies ist ein digital signierter Nachrichtenteil
Url : http://mail.zope.org/pipermail/zope3-dev/attachments/20070307/6b62fa6a/attachment.bin


More information about the Zope3-dev mailing list