web/action.py
changeset 9567 b87c09f853d3
parent 8190 2a3c1b787688
child 10666 7f6b5f023884
--- a/web/action.py	Thu Mar 06 13:59:24 2014 +0100
+++ b/web/action.py	Fri Mar 07 10:27:14 2014 +0100
@@ -25,43 +25,11 @@
 
 The most important method from a developper point of view in the
 :meth:'Action.url' method, which returns a URL on which the navigation
-should directed to perform the action.  There are two common ways of
-writing that method:
-
-* do nothing special and simply return a URL to the current rset with
-  a special view (with `self._cw.build_url(...)` for instance)
-
-* define an inner function `callback_func(req, *args)` which will do
-  the work and call it through `self._cw.user_callback(callback_func,
-  args, msg)`: this method will return a URL which calls the inner
-  function, and displays the message in the web interface when the
-  callback has completed (and report any exception occuring in the
-  callback too)
-
-Many examples of the first approach are available in :mod:`cubicweb.web.views.actions`.
-
-Here is an example of the second approach:
-
-.. sourcecode:: python
+should be directed to perform the action.  The common way of
+writing that method is to simply return a URL to the current rset with a
+special view (with `self._cw.build_url(...)` for instance) 
 
- from cubicweb.web import action
- class SomeAction(action.Action):
-     __regid__ = 'mycube_some_action'
-     title = _(some action)
-     __select__ = action.Action.__select__ & is_instance('TargetEntity')
- 
-     def url(self):
-         if self.cw_row is None:
-             eids = [row[0] for row in self.cw_rset]
-         else:
-             eids = (self.cw_rset[self.cw_row][self.cw_col or 0],)
-         def do_action(req, eids):
-             for eid in eids:
-                 entity = req.entity_from_eid(eid, 'TargetEntity')
-                 entity.perform_action()
-         msg = self._cw._('some_action performed')
-         return self._cw.user_callback(do_action, (eids,), msg)
-
+Many examples are available in :mod:`cubicweb.web.views.actions`.
 """
 
 __docformat__ = "restructuredtext en"