web/action.py
branchtls-sprint
changeset 648 a89ba1054cb2
parent 640 8e64f12be69c
child 651 ab6e15854f8c
equal deleted inserted replaced
647:49bb57a9606b 648:a89ba1054cb2
   106         linkto = '%s:%s:%s' % (self.rtype, current_entity.eid, target(self))
   106         linkto = '%s:%s:%s' % (self.rtype, current_entity.eid, target(self))
   107         return self.build_url(vid='creation', etype=self.etype,
   107         return self.build_url(vid='creation', etype=self.etype,
   108                               __linkto=linkto,
   108                               __linkto=linkto,
   109                               __redirectpath=current_entity.rest_path(), # should not be url quoted!
   109                               __redirectpath=current_entity.rest_path(), # should not be url quoted!
   110                               __redirectvid=self.req.form.get('__redirectvid', ''))
   110                               __redirectvid=self.req.form.get('__redirectvid', ''))
   111 
       
   112 
       
   113 class LinkToEntityAction2(LinkToEntityAction):
       
   114     """LinkToEntity action where the action is not usable on the same
       
   115     entity's type as the one refered by the .etype attribute
       
   116     """
       
   117     def my_selector(cls, req, rset, row=None, col=0, **kwargs):
       
   118         return chainall(match_search_state('normal'),
       
   119                         but_etype, one_line_rset, accept,
       
   120                         relation_possible(cls.rtype, role(cls), cls.etype),
       
   121                         may_add_relation(cls.rtype, role(cls)))
       
   122     __selectors__ = my_selector,
       
   123     
   111