cubicweb-container #3595279 compulsory_hooks_categories does not work [done]
As far as I can see, setting this attribute in the clone adapter does not enable specified hooks categories. E.g. I'm trying to set compulsory_hooks_categories=('workflow', ) but none of the workflow hooks are actually triggered during cloning. Using the "fastimport" cube will provide an appropriate & efficient "hooksrunner" object that will honor hooks. | |
priority | important |
---|---|
type | bug |
done in | 2.7.0 |
load | 0.100 |
load left | 0.000 |
closed by | <not specified> |
patch | Clone: with non-inlined relations, use .insert_relations [applied]Clone: use the fastimport flush controller and .insert_entities [applied] |
Comments
-
2014/02/27 15:46, written by acampeas
-
2014/02/27 16:04, written by dlaxalde
-
2014/02/27 16:14, written by acampeas
-
2014/02/27 15:47, written by acampeas
-
2014/02/27 16:07, written by dlaxalde
-
2014/02/27 16:12, written by acampeas
-
2014/02/28 08:16, written by dlaxalde
-
2014/02/28 09:24, written by acampeas
-
2014/02/28 09:28, written by dlaxalde
-
2014/02/28 09:36, written by acampeas
add commentWhat version of container are you working with ?
Tried with early 2.3 (50e501565b67) and later on after the series of changesets on cloning.
The handling of entities is now out of reach of the hooks manager from 2.3.0. We will indeed have to devise something for people that want to run hooks anyway.
Also note that doing compulsory_hooks_categories=('workflow', ) is not a meaningful thing to do.
Maybe I'm using the wrong tool. I want my cloned entities to be in their initial state (as defined by their workflow). So I skipped in_state relation for cloning, but the latter remains at None.
By _definition_ of cloning, your cloned entities will be in whatever state they where cloned from.
It seems the proper category is 'metadata' (looking at cubicweb/hooks/workflows.py). Still, it does not work.
What do you expect to actually happen with this hook category ?
I would expect cloned entities to be in their initial workflow state, if I skip the in_state relation for cloning. Currently, they are in an undefined state.
What are you trying to achieve ?
Clone is a simple, well defined, unambiguous protocol.
You seem to actually want a kind of _transform_. The clone machinery in itself gives some rope for this.
If you need to reset entities states, you need to do it as an explicit step after the clone operation. The container hooks already provide some hints as how to proceed (e.g. "finalize_cloned_container").