Commit 2fdece65 authored by Ayush Tiwari's avatar Ayush Tiwari

erp5_catalog: [WORKAROUND] Explicitly call reset for component_tool in test.

After adding document component object, _p_oid was bing generated at the
last step of commit hook. This led to problem that _registry_dict for
dynamic_class 'erp5.component.document' wasn't getting updated with
the _p_oid of the component created. This led to failing of test because
to validate object with same reference, the checkConsistency function
checks in the _registry_dict for reference and _p_oid.

Explicilty calling commit here generates the oid before validation, hence
make it available for the registry_dict in time.

But, this clearly is a workaround which is clearly not solving the real
problem of why the _p_oid isn't being generated at the right step.

Also, me(Ayush), tried to recreate this error on a running instance, but
it worked fine there.
parent 91b83a3a
...@@ -1967,6 +1967,7 @@ def bar(*args, **kwargs): ...@@ -1967,6 +1967,7 @@ def bar(*args, **kwargs):
reference = 'ValidateComponentWithSameReferenceVersionAlreadyValidated' reference = 'ValidateComponentWithSameReferenceVersionAlreadyValidated'
component = self._newComponent(reference, 'def foo():\n print "ok"') component = self._newComponent(reference, 'def foo():\n print "ok"')
self.commit()
component.validate() component.validate()
self.tic() self.tic()
......
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