[Zope3-dev] Proposal for optimized Blob handling

Christian Theune ct at gocept.com
Wed Mar 7 15:04:20 EST 2007


Am Mittwoch, den 07.03.2007, 20:50 +0100 schrieb Dieter Maurer:
> Christian Theune wrote at 2007-3-7 17:37 +0100:
> >I'm writing up a proposal for the ZODB to make even more efficient Blob
> >handling possible.
> >
> >This includes not copying the data from an uploaded file, but using a
> >`link` operation when possible. 
> 
> Is it possible at all?
> 
> Uploaded files end up in a temporary file.
> 
> They need to get moved away from this temporary location
> (as they are likely to be deleted at various administrator decided dates).

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'

-- 
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/2ca57f45/attachment.bin


More information about the Zope3-dev mailing list