server/hookhelper.py
author Sylvain Thénault <sylvain.thenault@logilab.fr>
Mon, 17 Aug 2009 18:25:57 +0200
changeset 2880 bfc8e1831290
parent 2840 06daf13195d4
parent 2876 b6993462ddb9
child 2968 0e3460341023
permissions -rw-r--r--
backport stable branch

"""helper functions for application hooks

:organization: Logilab
:copyright: 2001-2009 LOGILAB S.A. (Paris, FRANCE), license is LGPL v2.
:contact: http://www.logilab.fr/ -- mailto:contact@logilab.fr
:license: GNU Lesser General Public License, v2.1 - http://www.gnu.org/licenses
"""
__docformat__ = "restructuredtext en"

from logilab.common.deprecation import deprecated, class_moved

from cubicweb import RepositoryError


@deprecated('[3.5] entity_name is deprecated, use entity.name')
def entity_name(session, eid):
    """return the "name" attribute of the entity with the given eid"""
    return session.entity_from_eid(eid).name

@deprecated('[3.5] rproperty is deprecated, use session.schema_rproperty')
def rproperty(session, rtype, eidfrom, eidto, rprop):
    return session.rproperty(rtype, eidfrom, eidto, rprop)

from cubicweb.server.hook import SendMailOp
from cubicweb.hooks.workflow import previous_state
SendMailOp = class_moved(SendMailOp)
previous_state = deprecated('[3.5] use cubicweb.hooks.workflow.previous_state')(previous_state)