Re: [Zope-dev] why is this more efficient
On Mon, 23 Apr 2001, Tim McLaughlin wrote: > Found this in the constructor for the File Product and I don't understand > why it is more efficient. (I want to subclass a File, so this does have > some purpose ;-)) Anybody got any ideas? > > # First, we create the file without data: > self._setObject(id, File(id,title,'',content_type, precondition)) > > # Now we "upload" the data. By doing this in two steps, we > # can use a database trick to make the upload more efficient. > self._getOb(id).manage_upload(file) It's more efficient because manage_upload commits subtransactions every N bytes and your main process memory doesn't grow to the size of the file. -Michel ___ Zope-Dev maillist - [EMAIL PROTECTED] http://lists.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope )
[Zope-dev] why is this more efficient
Found this in the constructor for the File Product and I don't understand why it is more efficient. (I want to subclass a File, so this does have some purpose ;-)) Anybody got any ideas? # First, we create the file without data: self._setObject(id, File(id,title,'',content_type, precondition)) # Now we "upload" the data. By doing this in two steps, we # can use a database trick to make the upload more efficient. self._getOb(id).manage_upload(file) ___ Tim McLaughlin BCSwebservices.net Director, Technical Group 1950 Old Gallows Road tel: (703) 790.8081 x111 Suite 201 [EMAIL PROTECTED] Vienna, VA 22182 www .bcswebservices. net ___ Zope-Dev maillist - [EMAIL PROTECTED] http://lists.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope )