server/hookhelper.py
changeset 7990 a673d1d9a738
parent 7989 db76e8aaec29
child 7991 dcc5a4d48122
equal deleted inserted replaced
7989:db76e8aaec29 7990:a673d1d9a738
     1 # copyright 2003-2010 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
       
     2 # contact http://www.logilab.fr/ -- mailto:contact@logilab.fr
       
     3 #
       
     4 # This file is part of CubicWeb.
       
     5 #
       
     6 # CubicWeb is free software: you can redistribute it and/or modify it under the
       
     7 # terms of the GNU Lesser General Public License as published by the Free
       
     8 # Software Foundation, either version 2.1 of the License, or (at your option)
       
     9 # any later version.
       
    10 #
       
    11 # CubicWeb is distributed in the hope that it will be useful, but WITHOUT
       
    12 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
       
    13 # FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public License for more
       
    14 # details.
       
    15 #
       
    16 # You should have received a copy of the GNU Lesser General Public License along
       
    17 # with CubicWeb.  If not, see <http://www.gnu.org/licenses/>.
       
    18 """helper functions for application hooks
       
    19 
       
    20 """
       
    21 __docformat__ = "restructuredtext en"
       
    22 
       
    23 from logilab.common.deprecation import deprecated, class_moved
       
    24 
       
    25 from cubicweb.server import hook
       
    26 
       
    27 @deprecated('[3.6] entity_oldnewvalue should be imported from cw.server.hook')
       
    28 def entity_oldnewvalue(entity, attr):
       
    29     return hook.entity_oldnewvalue(entity, attr)
       
    30 
       
    31 @deprecated('[3.6] entity_name is deprecated, use entity.name')
       
    32 def entity_name(session, eid):
       
    33     """return the "name" attribute of the entity with the given eid"""
       
    34     return session.entity_from_eid(eid).name
       
    35 
       
    36 @deprecated('[3.6] rproperty is deprecated, use session.schema_rproperty')
       
    37 def rproperty(session, rtype, eidfrom, eidto, rprop):
       
    38     return session.rproperty(rtype, eidfrom, eidto, rprop)
       
    39 
       
    40 SendMailOp = class_moved(hook.SendMailOp)