9 """ |
9 """ |
10 |
10 |
11 applcubicwebversion, cubicwebversion = versions_map['cubicweb'] |
11 applcubicwebversion, cubicwebversion = versions_map['cubicweb'] |
12 |
12 |
13 if applcubicwebversion < (3, 4, 0) and cubicwebversion >= (3, 4, 0): |
13 if applcubicwebversion < (3, 4, 0) and cubicwebversion >= (3, 4, 0): |
14 from cubicweb import RepositoryError |
14 |
15 from cubicweb.server.hooks import uniquecstrcheck_before_modification |
|
16 session.set_shared_data('do-not-insert-cwuri', True) |
15 session.set_shared_data('do-not-insert-cwuri', True) |
17 repo.hm.unregister_hook(uniquecstrcheck_before_modification, 'before_add_entity', '') |
16 deactivate_verification_hooks() |
18 repo.hm.unregister_hook(uniquecstrcheck_before_modification, 'before_update_entity', '') |
|
19 add_relation_type('cwuri') |
17 add_relation_type('cwuri') |
20 base_url = session.base_url() |
18 base_url = session.base_url() |
21 # use an internal session since some entity might forbid modifications to admin |
19 # use an internal session since some entity might forbid modifications to admin |
22 isession = repo.internal_session() |
20 isession = repo.internal_session() |
23 for eid, in rql('Any X', ask_confirm=False): |
21 for eid, in rql('Any X', ask_confirm=False): |
24 type, source, extid = session.describe(eid) |
22 type, source, extid = session.describe(eid) |
25 if source == 'system': |
23 if source == 'system': |
26 isession.execute('SET X cwuri %(u)s WHERE X eid %(x)s', |
24 isession.execute('SET X cwuri %(u)s WHERE X eid %(x)s', |
27 {'x': eid, 'u': base_url + u'eid/%s' % eid}) |
25 {'x': eid, 'u': base_url + u'eid/%s' % eid}) |
28 isession.commit() |
26 isession.commit() |
29 repo.hm.register_hook(uniquecstrcheck_before_modification, 'before_add_entity', '') |
27 reactivate_verification_hooks() |
30 repo.hm.register_hook(uniquecstrcheck_before_modification, 'before_update_entity', '') |
|
31 session.set_shared_data('do-not-insert-cwuri', False) |
28 session.set_shared_data('do-not-insert-cwuri', False) |
32 |
29 |
33 if applcubicwebversion < (3, 2, 2) and cubicwebversion >= (3, 2, 1): |
30 if applcubicwebversion < (3, 2, 2) and cubicwebversion >= (3, 2, 1): |
34 from base64 import b64encode |
31 from base64 import b64encode |
35 for table in ('entities', 'deleted_entities'): |
32 for table in ('entities', 'deleted_entities'): |