How to migrate a file using CPSRemoteController

Miguel Sánchez Beato <[email protected]> Thu, 24 May 2007 10:08:45 +0200
Newsgroups gmane.comp.web.zope.cps.devel
Message-ID <[email protected]>
Hello!
I'm using CPSRemoteController to "migrate" a file from a CPS 3.4.0 
instance (A) to a CPS 3.4.4 instance (B). What I'm trying to do is take 
a File document from A and put it in B. I've developed a new method for 
the RemoteControllerTool class called getAttachedFile that takes the 
attached file from the File document. The problem comes when I create 
the new File document (using the RemoteController method 
"createDocument"). this method use a binary  file as attached file, and 
that binary file is read using a file system path, as a example:

f.open(file_path)
binary = Binary(f.read())
f.close()

doc_def = {'Title': doc_title,
                   'Description': doc_desc,
                   'file' : binary,                   
                   'file_name' : "file_title",
                   'file_type' : 'File',
                   }                

doc_type = 'File'
doc_folder_path = 'workspaces/files'
proxy.createDocument(doc_type, doc_def,  doc_folder_path, 0)

So, I need to download the file to the file system in order to 
upload/read it using a "file_path".

Anyboby knows how to do it?
Could be a new mehtod of RemoteControllerTool?
Is there other way to migrate the whole structure of a folder tree (with 
all documents inside) from an instance to another?

Thank you!!
_______________________________________________
cps-devel mailing list
http://lists.nuxeo.com/mailman/listinfo/cps-devel