equal
deleted
inserted
replaced
223 |
223 |
224 * ``bookmark``, bookmark entities handling hooks |
224 * ``bookmark``, bookmark entities handling hooks |
225 |
225 |
226 |
226 |
227 Nothing precludes one to invent new categories and use the |
227 Nothing precludes one to invent new categories and use the |
228 :class:`~cubicweb.server.session.hooks_control` context manager to filter them |
228 :class:`~cubicweb.server.session.hooks_control` context manager to |
229 in or out. |
229 filter them in or out. Note that ending the transaction with commit() |
|
230 or rollback() will restore the hooks. |
230 |
231 |
231 |
232 |
232 Hooks specific selector |
233 Hooks specific selector |
233 ~~~~~~~~~~~~~~~~~~~~~~~ |
234 ~~~~~~~~~~~~~~~~~~~~~~~ |
234 .. autoclass:: cubicweb.server.hook.match_rtype |
235 .. autoclass:: cubicweb.server.hook.match_rtype |
297 with security_enabled(session, read=False): |
298 with security_enabled(session, read=False): |
298 hooks = sorted(self.possible_objects(session, **kwargs), |
299 hooks = sorted(self.possible_objects(session, **kwargs), |
299 key=lambda x: x.order) |
300 key=lambda x: x.order) |
300 with security_enabled(session, write=False): |
301 with security_enabled(session, write=False): |
301 for hook in hooks: |
302 for hook in hooks: |
|
303 #print hook.category, hook.__regid__ |
302 hook() |
304 hook() |
303 |
305 |
304 class HooksManager(object): |
306 class HooksManager(object): |
305 def __init__(self, vreg): |
307 def __init__(self, vreg): |
306 self.vreg = vreg |
308 self.vreg = vreg |