[CPS-devel] How to migrate a file using CPSRemoteController

Miguel Sánchez Beato miguel.sanchez at iavante.es
Thu May 24 10:08:45 CEST 2007


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



This list archive provided by Nuxeo, the leaders of open source ECM. Check out the Nuxeo 5 open source, standards-based ECM project.