web/action.py
branchtls-sprint
changeset 657 fd019f41aa2f
parent 653 189877d9547d
child 661 4f61eb8a96b7
equal deleted inserted replaced
656:3f2956c186ef 657:fd019f41aa2f
     8 
     8 
     9 from logilab.common.deprecation import class_moved
     9 from logilab.common.deprecation import class_moved
    10 
    10 
    11 from cubicweb import role, target
    11 from cubicweb import role, target
    12 from cubicweb.selectors import (relation_possible, match_search_state,
    12 from cubicweb.selectors import (relation_possible, match_search_state,
    13                                 one_line_rset, may_add_relation,
    13                                 one_line_rset, may_add_relation, yes,
    14                                 accepts_compat)
    14                                 accepts_compat, condition_compat, deprecate)
    15 from cubicweb.common.appobject import AppRsetObject
    15 from cubicweb.common.appobject import AppRsetObject
    16 from cubicweb.common.registerers import action_registerer
    16 from cubicweb.common.registerers import action_registerer
    17 
    17 
    18 _ = unicode
    18 _ = unicode
    19 
    19 
    22     """abstract action. Handle the .search_states attribute to match
    22     """abstract action. Handle the .search_states attribute to match
    23     request search state. 
    23     request search state. 
    24     """
    24     """
    25     __registry__ = 'actions'
    25     __registry__ = 'actions'
    26     __registerer__ = action_registerer
    26     __registerer__ = action_registerer
    27 
    27     __selectors__ = (yes,) 
       
    28     
    28     property_defs = {
    29     property_defs = {
    29         'visible':  dict(type='Boolean', default=True,
    30         'visible':  dict(type='Boolean', default=True,
    30                          help=_('display the action or not')),
    31                          help=_('display the action or not')),
    31         'order':    dict(type='Int', default=99,
    32         'order':    dict(type='Int', default=99,
    32                          help=_('display order of the action')),
    33                          help=_('display order of the action')),
    91         return self.build_url(vid='creation', etype=self.etype,
    92         return self.build_url(vid='creation', etype=self.etype,
    92                               __linkto=linkto,
    93                               __linkto=linkto,
    93                               __redirectpath=current_entity.rest_path(), # should not be url quoted!
    94                               __redirectpath=current_entity.rest_path(), # should not be url quoted!
    94                               __redirectvid=self.req.form.get('__redirectvid', ''))
    95                               __redirectvid=self.req.form.get('__redirectvid', ''))
    95 
    96 
    96 
    97 class EntityAction(Action):
    97 EntityAction = class_moved('EntityAction', Action,
    98     """DEPRECATED / BACKWARD COMPAT
    98                            'EntityAction is deprecated, use Action with appropriate selectors')
    99     """
       
   100     registered = deprecate(accepts_compat(condition_compat(Action.registered)),
       
   101                            msg='EntityAction is deprecated, use Action with '
       
   102                            'appropriate selectors')
    99     
   103