[CPS-devel] transtyping documents to folderish documents

Jean-Marc Orliaguet jmo at ita.chalmers.se
Fri Jun 2 15:08:45 CEST 2006


Julien Anguenot wrote:
> Salut Jean-Marc,
>
> Jean-Marc Orliaguet wrote:
>   
>> I'm about to migrate a couple of documents from "documentish" to
>> folderish (FolderishProxyDocument)
>>
>> CPS uses isinstance(ProxyFolderishDocument) in some places, so changing
>> to portal type to folderish is not enough.
>>
>> instances must be changed too.
>>
>> the current script does:
>>
>>     for brain in brains:
>>        ob = brain.getObject()
>>        if ob is None:
>>            continue
>>
>>        if isinstance(ob, ProxyFolderishDocument):
>>            continue
>>
>>        ob.__class__ = ProxyFolderishDocument
>>        ob._p_changed = 1 # trigger persistence
>>        ob.proxyChanged()
>>
>>        # + some workflow history stuff omitted here
>>
>> anything more to think about ?
>>     
>
> You may need to update the workflow related annotations on the object as
> well and ensure it's compatible with the folferish workflow your objects
> are gonna follow after this migration. I guess you will need to update
> your workflow associations as well to specify a folderish workflow
> instead of the former one.
>
> Keep us posted about the result.
>
> 	J.
>
>   

Yes, I did that too.  The tricky issue was the __class__ change, it 
didn't get persisted correctly in the beginning.

here is the entire script ...

cross-fingers ;-)

/JM






-------------- next part --------------
A non-text attachment was scrubbed...
Name: upgrade.py
Type: text/x-python
Size: 1514 bytes
Desc: not available
Url : http://lists.nuxeo.com/pipermail/cps-devel/attachments/20060602/f6632ea6/upgrade.py


More information about the cps-devel mailing list

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