cubicweb/cwvreg.py
branch3.26
changeset 12497 c81e29cd8cff
parent 11900 8496135b6dc1
child 12511 e312461d3200
equal deleted inserted replaced
12493:2c47461fec21 12497:c81e29cd8cff
   248         """return an ordered list of possible actions"""
   248         """return an ordered list of possible actions"""
   249         return sorted(self.possible_objects(*args, **kwargs),
   249         return sorted(self.possible_objects(*args, **kwargs),
   250                       key=lambda x: x.order)
   250                       key=lambda x: x.order)
   251 
   251 
   252     def possible_actions(self, req, rset=None, **kwargs):
   252     def possible_actions(self, req, rset=None, **kwargs):
       
   253         if not kwargs:
       
   254             raise ValueError("ActionsRegistry.possible_actions should always be "
       
   255                              "called with additional keywords arguments (in "
       
   256                              "addition of req and the optional argument rset) "
       
   257                              "to optimised cache computation but you provided "
       
   258                              "none.\n\nFor exemple if you are working on a view, "
       
   259                              "provide the view as a keyword argument to "
       
   260                              "possible_actions like this: view=my_view.")
       
   261 
   253         if rset is None:
   262         if rset is None:
   254             actions = self.poss_visible_objects(req, rset=rset, **kwargs)
   263             actions = self.poss_visible_objects(req, rset=rset, **kwargs)
   255         else:
   264         else:
   256             actions = rset.possible_actions(**kwargs) # cached implementation
   265             actions = rset.possible_actions(**kwargs) # cached implementation
   257         result = {}
   266         result = {}