Commit f9cf68ed authored by Jérome Perrin's avatar Jérome Perrin

ERP5Type: don't set portal_type on instance

It's enough to set on the class and if we don't have it on instances, it
saves a few bytes in pickles
parent b39b5e7b
Pipeline #24839 failed with stage
in 0 seconds
...@@ -84,7 +84,6 @@ class TestZODBHistory(ERP5TypeTestCase): ...@@ -84,7 +84,6 @@ class TestZODBHistory(ERP5TypeTestCase):
self.assertTrue(len(history_list) > 0) self.assertTrue(len(history_list) > 0)
d = history_list[0] d = history_list[0]
changes = d['changes'] changes = d['changes']
self.assertEqual(changes['portal_type'], 'Organisation')
self.assertEqual(changes['id'], 'org') self.assertEqual(changes['id'], 'org')
self.assertTrue(changes['uid'] is not None) self.assertTrue(changes['uid'] is not None)
......
...@@ -399,6 +399,7 @@ class ERP5TypeInformation(XMLObject, ...@@ -399,6 +399,7 @@ class ERP5TypeInformation(XMLObject,
self.getId(), self.getId(),
temp=temp_object) temp=temp_object)
base_ob = klass(id) base_ob = klass(id)
assert base_ob.portal_type == self.getId()
ob = base_ob.__of__(container) ob = base_ob.__of__(container)
if temp_object: if temp_object:
...@@ -422,10 +423,6 @@ class ERP5TypeInformation(XMLObject, ...@@ -422,10 +423,6 @@ class ERP5TypeInformation(XMLObject,
if getattr(base_ob, 'uid', None) is None: if getattr(base_ob, 'uid', None) is None:
ob.uid = portal.portal_catalog.newUid() ob.uid = portal.portal_catalog.newUid()
# Portal type has to be set before setting other attributes
# in order to initialize aq_dynamic
ob.portal_type = self.getId()
if compute_local_role: if compute_local_role:
# Do not reindex object because it's already done by manage_afterAdd # Do not reindex object because it's already done by manage_afterAdd
self.updateLocalRolesOnDocument(ob, reindex=False) self.updateLocalRolesOnDocument(ob, reindex=False)
......
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