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 - [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