server/hook.py
branchstable
changeset 5210 1c635a91e403
parent 5194 395f076512a1
child 5220 42f854b6083d
equal deleted inserted replaced
5209:52c9d25101a1 5210:1c635a91e403
    27 
    27 
    28 Backup/restore hooks (eg server_backup, server_restore) have a `repo` and a
    28 Backup/restore hooks (eg server_backup, server_restore) have a `repo` and a
    29 `timestamp` attributes, but *their `_cw` attribute is None*.
    29 `timestamp` attributes, but *their `_cw` attribute is None*.
    30 
    30 
    31 Session hooks (eg session_open, session_close) have no special attribute.
    31 Session hooks (eg session_open, session_close) have no special attribute.
    32 
       
    33 
    32 
    34 :organization: Logilab
    33 :organization: Logilab
    35 :copyright: 2001-2010 LOGILAB S.A. (Paris, FRANCE), license is LGPL v2.
    34 :copyright: 2001-2010 LOGILAB S.A. (Paris, FRANCE), license is LGPL v2.
    36 :contact: http://www.logilab.fr/ -- mailto:contact@logilab.fr
    35 :contact: http://www.logilab.fr/ -- mailto:contact@logilab.fr
    37 :license: GNU Lesser General Public License, v2.1 - http://www.gnu.org/licenses
    36 :license: GNU Lesser General Public License, v2.1 - http://www.gnu.org/licenses
   469     since handling operations becomes coslty on massive data import.
   468     since handling operations becomes coslty on massive data import.
   470     """
   469     """
   471     try:
   470     try:
   472         session.transaction_data[datakey].add(value)
   471         session.transaction_data[datakey].add(value)
   473     except KeyError:
   472     except KeyError:
   474         opcls(session, *opkwargs)
   473         opcls(session, **opkwargs)
   475         session.transaction_data[datakey] = set((value,))
   474         session.transaction_data[datakey] = set((value,))
   476 
   475 
   477 
   476 
   478 class LateOperation(Operation):
   477 class LateOperation(Operation):
   479     """special operation which should be called after all possible (ie non late)
   478     """special operation which should be called after all possible (ie non late)