server/migractions.py
branchstable
changeset 6571 71b446d1cf93
parent 6323 a11c1e3c16c3
child 6574 a7bbd69f1d1c
equal deleted inserted replaced
6562:34be5986bca0 6571:71b446d1cf93
    42 from copy import copy
    42 from copy import copy
    43 from warnings import warn
    43 from warnings import warn
    44 
    44 
    45 from logilab.common.deprecation import deprecated
    45 from logilab.common.deprecation import deprecated
    46 from logilab.common.decorators import cached, clear_cache
    46 from logilab.common.decorators import cached, clear_cache
    47 from logilab.common.testlib import mock_object
       
    48 
    47 
    49 from yams.constraints import SizeConstraint
    48 from yams.constraints import SizeConstraint
    50 from yams.schema2sql import eschema2sql, rschema2sql
    49 from yams.schema2sql import eschema2sql, rschema2sql
    51 
    50 
    52 from cubicweb import AuthenticationError, ExecutionError
    51 from cubicweb import AuthenticationError, ExecutionError
    63     from cubicweb.server import SOURCE_TYPES, schemaserial as ss
    62     from cubicweb.server import SOURCE_TYPES, schemaserial as ss
    64     from cubicweb.server.utils import manager_userpasswd, ask_source_config
    63     from cubicweb.server.utils import manager_userpasswd, ask_source_config
    65     from cubicweb.server.sqlutils import sqlexec, SQL_PREFIX
    64     from cubicweb.server.sqlutils import sqlexec, SQL_PREFIX
    66 except ImportError: # LAX
    65 except ImportError: # LAX
    67     pass
    66     pass
       
    67 
       
    68 
       
    69 def mock_object(**params):
       
    70     return type('Mock', (), params)()
    68 
    71 
    69 class ClearGroupMap(hook.Hook):
    72 class ClearGroupMap(hook.Hook):
    70     __regid__ = 'cw.migration.clear_group_mapping'
    73     __regid__ = 'cw.migration.clear_group_mapping'
    71     __select__ = hook.Hook.__select__ & is_instance('CWGroup')
    74     __select__ = hook.Hook.__select__ & is_instance('CWGroup')
    72     events = ('after_add_entity', 'after_update_entity',)
    75     events = ('after_add_entity', 'after_update_entity',)