29 repo.hm.register_hook(uniquecstrcheck_before_modification, 'before_add_entity', '') |
29 repo.hm.register_hook(uniquecstrcheck_before_modification, 'before_add_entity', '') |
30 repo.hm.register_hook(uniquecstrcheck_before_modification, 'before_update_entity', '') |
30 repo.hm.register_hook(uniquecstrcheck_before_modification, 'before_update_entity', '') |
31 session.set_shared_data('do-not-insert-cwuri', False) |
31 session.set_shared_data('do-not-insert-cwuri', False) |
32 |
32 |
33 if applcubicwebversion < (3, 5, 0) and cubicwebversion >= (3, 5, 0): |
33 if applcubicwebversion < (3, 5, 0) and cubicwebversion >= (3, 5, 0): |
|
34 # check that migration is not doomed |
|
35 rset = rql('Any X,Y WHERE X transition_of E, Y transition_of E, ' |
|
36 'X name N, Y name N, NOT X identity Y', |
|
37 ask_confirm=False) |
|
38 if rset: |
|
39 from logilab.common.shellutils import ASK |
|
40 if not ASK.confirm('Migration will fail because of transitions with the same name. ' |
|
41 'Continue anyway ?'): |
|
42 import sys |
|
43 sys.exit(1) |
|
44 # proceed with migration |
34 add_entity_type('Workflow') |
45 add_entity_type('Workflow') |
35 add_entity_type('BaseTransition') |
46 add_entity_type('BaseTransition') |
36 add_entity_type('WorkflowTransition') |
47 add_entity_type('WorkflowTransition') |
37 add_entity_type('SubWorkflowExitPoint') |
48 add_entity_type('SubWorkflowExitPoint') |
38 # drop explicit 'State allowed_transition Transition' since it should be |
49 # drop explicit 'State allowed_transition Transition' since it should be |