[Zope3-dev] Proposal for optimized Blob handling

Uwe Oestermeier u.oestermeier at iwm-kmrc.de
Wed Mar 7 15:31:52 EST 2007


Christian Theune <ct at gocept.com> 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'

:)

Why not rename the temp file to a place in the blob directory?
That would also avoid the copy operation.

Uwe


________________________________________________________________
Dr. Uwe Oestermeier
Institut für Wissensmedien
Knowledge Media Research Center
Konrad-Adenauer-Str. 40
D-72072 Tuebingen
Germany
u.oestermeier at iwm-kmrc.de
Tel. +49 7071 979-208
Fax +49 7071 979-100





More information about the Zope3-dev mailing list