For the past few years we've been using an ugly, but working, trick to  
export data out of a Zope 3 instance without exporting every bit of  
content. Given an object to export, we use  
'locationCopy' (zope.location.pickling) to get a deep copy, set the  
__parent__ attribute of the copied object to None, put it in the ZODB  
root (root[EXPORT_KEY] = detached_copy), and then commit the  
transaction. This is so that we have the 'oid' and connection needed  
for ZODB's 'exportFile' to work.

If there's a better way of setting `__parent__` to None (or just not  
following the __parent__ ref during Export, without affecting the  
saved state in the database), I'd love to know. But that's an aside.

I exported some content tonight that had Blobs in it. Upon import, I  
noticed that the blob files in the destination were empty (zero- 
length). Looking at the ZEXP file, I could see the BLOBSTART markers,  
but could see no binary data. Tracing down into the export, and then  
just playing around with 'locationCopy' to make other detached copies,  
I noticed that the Blob contents were never copied into the new file.

What can I do here? I'm in the midst of a botched deployment of some  
content updates for a customer. I thought that copying something  
'containing' a Blob would cause its contents to be copied. If this is  
an exercise for application layer code, how can I get plugged in and  
know when a Blob is being copied inside of a deep copy?

Thanks,

--
Jeff Shell
[EMAIL PROTECTED]

_______________________________________________
For more information about ZODB, see the ZODB Wiki:
http://www.zope.org/Wikis/ZODB/

ZODB-Dev mailing list  -  ZODB-Dev@zope.org
http://mail.zope.org/mailman/listinfo/zodb-dev

Reply via email to