server/hook.py
changeset 8561 77ea3eed9946
parent 8535 268b6349baf3
child 8562 0d2fb4604265
equal deleted inserted replaced
8560:fef0b8214fcf 8561:77ea3eed9946
   195 
   195 
   196 Hooks control
   196 Hooks control
   197 ~~~~~~~~~~~~~
   197 ~~~~~~~~~~~~~
   198 
   198 
   199 It is sometimes convenient to explicitly enable or disable some hooks. For
   199 It is sometimes convenient to explicitly enable or disable some hooks. For
   200 instance if you want to disable some integrity checking hook.  This can be
   200 instance if you want to disable some integrity checking hook. This can be
   201 controlled more finely through the `category` class attribute, which is a string
   201 controlled more finely through the `category` class attribute, which is a string
   202 giving a category name.  One can then uses the
   202 giving a category name.  One can then uses the
   203 :class:`~cubicweb.server.session.hooks_control` context manager to explicitly
   203 :meth:`~cubicweb.server.session.Session.deny_all_hooks_but` and
   204 enable or disable some categories.
   204 :meth:`~cubicweb.server.session.Session.allow_all_hooks_but` context managers to
   205 
   205 explicitly enable or disable some categories.
   206 .. autoclass:: cubicweb.server.session.hooks_control
       
   207 
       
   208 
   206 
   209 The existing categories are:
   207 The existing categories are:
   210 
   208 
   211 * ``security``, security checking hooks
   209 * ``security``, security checking hooks
   212 
   210 
   228 * ``email``, email address handling hooks
   226 * ``email``, email address handling hooks
   229 
   227 
   230 * ``bookmark``, bookmark entities handling hooks
   228 * ``bookmark``, bookmark entities handling hooks
   231 
   229 
   232 
   230 
   233 Nothing precludes one to invent new categories and use the
   231 Nothing precludes one to invent new categories and use existing mechanisms to
   234 :class:`~cubicweb.server.session.hooks_control` context manager to
   232 filter them in or out.
   235 filter them in or out. Note that ending the transaction with commit()
       
   236 or rollback() will restore the hooks.
       
   237 
   233 
   238 
   234 
   239 Hooks specific predicates
   235 Hooks specific predicates
   240 ~~~~~~~~~~~~~~~~~~~~~~~~~
   236 ~~~~~~~~~~~~~~~~~~~~~~~~~
   241 .. autoclass:: cubicweb.server.hook.match_rtype
   237 .. autoclass:: cubicweb.server.hook.match_rtype