[ZODB-Dev] Copying persistent objects between databases

Paul Winkler pw_lists at slinkp.com
Tue Nov 23 13:26:12 EST 2004


On Tue, Nov 23, 2004 at 12:32:42PM -0500, Tim Peters wrote:
> This kind of thing may well be why ExportImport.py exists, but I really
> don't know.  Anyone know better?  Someone must <wink>.

Well, Zope uses it, and it Just Plain Works.
>From lib/python/OFS/ObjectManager.py: 

    def manage_exportObject(self, id='', download=None, toxml=None,
                            RESPONSE=None,REQUEST=None):
        """Exports an object to a file and returns that file."""

        ... 
            ob._p_jar.exportFile(ob._p_oid, f)
        ...

    def _importObjectFromFile(self, filepath, verify=1, set_owner=1):
        # locate a valid connection
        connection=self._p_jar
        obj=self
        ...

        ob=connection.importFile(
            filepath, customImporters=customImporters)
        ...


-- 

Paul Winkler
http://www.slinkp.com


More information about the ZODB-Dev mailing list