Commit 7a787cc4 authored by Jérome Perrin's avatar Jérome Perrin

Add an external method to update the class of a persistent object.


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@5763 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 567f065d
......@@ -10,3 +10,13 @@ def fixProductNames(self, REQUEST=None):
msg += 'Change the Product Name of %s from %s to ERP5Type\n' % (contentType.getId(), contentType.product)
contentType.product = 'ERP5Type'
return msg
def changeObjectClass(self, container, object_id, new_class):
"""Creates a copy of object_id inside container, changing its class to
new_class"""
old_obj = container._getObj(object_id)
new_obj = new_class(object_id)
new_obj.__dict__.update(old_obj.__dict__)
container._setObject(object_id, new_obj)
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment