[migration/3.10] fix AttributeError
'Connection' object has no attribute 'HOOKS_DENY_ALL'
--- a/misc/migration/3.10.0_Any.py Mon Mar 07 17:53:20 2016 +0100
+++ b/misc/migration/3.10.0_Any.py Wed Mar 09 17:01:42 2016 +0100
@@ -1,4 +1,3 @@
-from cubicweb.server.session import hooks_control
for uri, cfg in config.read_sources_file().items():
if uri in ('system', 'admin'):
@@ -9,7 +8,7 @@
add_relation_definition('CWSource', 'cw_source', 'CWSource')
add_entity_type('CWSourceHostConfig')
-with hooks_control(session, session.HOOKS_ALLOW_ALL, 'cw.sources'):
+with session.allow_all_hooks_but('cw.sources'):
create_entity('CWSource', type=u'native', name=u'system')
commit()
--- a/misc/migration/3.10.9_Any.py Mon Mar 07 17:53:20 2016 +0100
+++ b/misc/migration/3.10.9_Any.py Wed Mar 09 17:01:42 2016 +0100
@@ -14,7 +14,7 @@
enabled = interactive_mode
with progress(title=title, nbops=nbops, size=30, enabled=enabled) as pb:
for i, row in enumerate(rset):
- with hooks_control(session, session.HOOKS_DENY_ALL, 'integrity'):
+ with session.deny_all_hooks_but('integrity'):
data = {'eid': row[0], 'cwuri': row[1].replace(u'/eid', u'')}
rql('SET X cwuri %(cwuri)s WHERE X eid %(eid)s', data)
if not i % 100: # commit every 100 entities to limit memory consumption