hooks/integrity.py
changeset 6376 f8662240ed4d
parent 6142 8bc6eac1fac1
parent 6375 df4fd2a1b0e7
child 6426 541659c39f6a
equal deleted inserted replaced
6373:41793f2718ce 6376:f8662240ed4d
    24 from threading import Lock
    24 from threading import Lock
    25 
    25 
    26 from yams.schema import role_name
    26 from yams.schema import role_name
    27 
    27 
    28 from cubicweb import ValidationError
    28 from cubicweb import ValidationError
    29 from cubicweb.schema import RQLConstraint, RQLUniqueConstraint
    29 from cubicweb.schema import (META_RTYPES, WORKFLOW_RTYPES,
       
    30                              RQLConstraint, RQLUniqueConstraint)
    30 from cubicweb.selectors import is_instance
    31 from cubicweb.selectors import is_instance
    31 from cubicweb.uilib import soup2xhtml
    32 from cubicweb.uilib import soup2xhtml
    32 from cubicweb.server import hook
    33 from cubicweb.server import hook
    33 from cubicweb.server.hook import set_operation
    34 from cubicweb.server.hook import set_operation
    34 
    35 
    35 # special relations that don't have to be checked for integrity, usually
    36 # special relations that don't have to be checked for integrity, usually
    36 # because they are handled internally by hooks (so we trust ourselves)
    37 # because they are handled internally by hooks (so we trust ourselves)
    37 DONT_CHECK_RTYPES_ON_ADD = set(('owned_by', 'created_by',
    38 DONT_CHECK_RTYPES_ON_ADD = META_RTYPES | WORKFLOW_RTYPES
    38                                 'is', 'is_instance_of',
    39 DONT_CHECK_RTYPES_ON_DEL = META_RTYPES | WORKFLOW_RTYPES
    39                                 'wf_info_for', 'from_state', 'to_state'))
       
    40 DONT_CHECK_RTYPES_ON_DEL = set(('is', 'is_instance_of',
       
    41                                 'wf_info_for', 'from_state', 'to_state'))
       
    42 
    40 
    43 _UNIQUE_CONSTRAINTS_LOCK = Lock()
    41 _UNIQUE_CONSTRAINTS_LOCK = Lock()
    44 _UNIQUE_CONSTRAINTS_HOLDER = None
    42 _UNIQUE_CONSTRAINTS_HOLDER = None
    45 
    43 
    46 
    44