ERP5Type: allow pickling temp objects
What should not be allowed is to store persistent objects in ZODB, but pickling them should be OK. This is necessary if we want to store them in memcached. This also modifies loadTempPortalTypeClass which was returning a class with a different name than requested, by prepending "Temporary ". This prevented pickling, because pickle checks that the class is can be imported under its same name. This was problematic because before this change, we had such a behavior: (Pdb) tmp = self.portal.person_module.newContent(portal_type='Person', temp_object=True) (Pdb) tmp.__class__ <class 'erp5.temp_portal_type.Temporary Person'> (Pdb) import erp5.temp_portal_type (Pdb) getattr(erp5.temp_portal_type, 'Temporary Person') <class 'erp5.temp_portal_type.Temporary Temporary Person'> My understanding is that this prefix in the class name was not useful, that class lives in another module than the "real" Person class.
Showing
Please register or sign in to comment