equal
deleted
inserted
replaced
43 from warnings import warn |
43 from warnings import warn |
44 from contextlib import contextmanager |
44 from contextlib import contextmanager |
45 |
45 |
46 from logilab.common.deprecation import deprecated |
46 from logilab.common.deprecation import deprecated |
47 from logilab.common.decorators import cached, clear_cache |
47 from logilab.common.decorators import cached, clear_cache |
48 from logilab.common.testlib import mock_object |
|
49 |
48 |
50 from yams.constraints import SizeConstraint |
49 from yams.constraints import SizeConstraint |
51 from yams.schema2sql import eschema2sql, rschema2sql |
50 from yams.schema2sql import eschema2sql, rschema2sql |
52 from yams.schema import RelationDefinitionSchema |
51 from yams.schema import RelationDefinitionSchema |
53 |
52 |
65 from cubicweb.server import SOURCE_TYPES, schemaserial as ss |
64 from cubicweb.server import SOURCE_TYPES, schemaserial as ss |
66 from cubicweb.server.utils import manager_userpasswd |
65 from cubicweb.server.utils import manager_userpasswd |
67 from cubicweb.server.sqlutils import sqlexec, SQL_PREFIX |
66 from cubicweb.server.sqlutils import sqlexec, SQL_PREFIX |
68 except ImportError: # LAX |
67 except ImportError: # LAX |
69 pass |
68 pass |
|
69 |
|
70 |
|
71 def mock_object(**params): |
|
72 return type('Mock', (), params)() |
70 |
73 |
71 class ClearGroupMap(hook.Hook): |
74 class ClearGroupMap(hook.Hook): |
72 __regid__ = 'cw.migration.clear_group_mapping' |
75 __regid__ = 'cw.migration.clear_group_mapping' |
73 __select__ = hook.Hook.__select__ & is_instance('CWGroup') |
76 __select__ = hook.Hook.__select__ & is_instance('CWGroup') |
74 events = ('after_add_entity', 'after_update_entity',) |
77 events = ('after_add_entity', 'after_update_entity',) |