#1256570: remove __method, it is not used in any of the cubes from logilab and encourages bad design by using Redirect (eg ui specific) from entities.py
--- a/web/views/basecontrollers.py Fri Oct 01 16:53:35 2010 +0200
+++ b/web/views/basecontrollers.py Fri Oct 01 17:27:54 2010 +0200
@@ -130,16 +130,6 @@
rset = self.process_rql()
else:
rset = None
- if rset and rset.rowcount == 1 and '__method' in req.form:
- entity = rset.get_entity(0, 0)
- try:
- method = getattr(entity, req.form.pop('__method'))
- method()
- except Redirect: # propagate redirect that might occur in method()
- raise
- except Exception, ex:
- self.exception('while handling __method')
- req.set_message(req._("error while handling __method: %s") % req._(ex))
vid = req.form.get('vid') or vid_from_rset(req, rset, self._cw.vreg.schema)
try:
view = self._cw.vreg['views'].select(vid, req, rset=rset)
--- a/web/views/editcontroller.py Fri Oct 01 16:53:35 2010 +0200
+++ b/web/views/editcontroller.py Fri Oct 01 17:27:54 2010 +0200
@@ -119,21 +119,6 @@
# no specific action, generic edition
self._to_create = req.data['eidmap'] = {}
self._pending_fields = req.data['pendingfields'] = set()
- try:
- methodname = req.form.pop('__method', None)
- for eid in req.edited_eids():
- # __type and eid
- formparams = req.extract_entity_params(eid, minparams=2)
- if methodname is not None:
- entity = req.entity_from_eid(eid)
- method = getattr(entity, methodname)
- method(formparams)
- eid = self.edit_entity(formparams)
- except (RequestError, NothingToEdit), ex:
- if '__linkto' in req.form and 'eid' in req.form:
- self.execute_linkto()
- elif not ('__delete' in req.form or '__insert' in req.form):
- raise ValidationError(None, {None: unicode(ex)})
# handle relations in newly created entities
if self._pending_fields:
for form, field in self._pending_fields: