# HG changeset patch # User Sylvain Thénault # Date 1268387595 -3600 # Node ID 11899d28337fc7b8358193157dc261cbbf2429d0 # Parent 4a42d700c52d20130dd5e99e6e8822c2f6c91be0 [web] cleanup: move delete_entities to the edit controller diff -r 4a42d700c52d -r 11899d28337f web/controller.py --- a/web/controller.py Fri Mar 12 10:52:43 2010 +0100 +++ b/web/controller.py Fri Mar 12 10:53:15 2010 +0100 @@ -87,26 +87,6 @@ if not self._edited_entity: self._edited_entity = entity - # XXX move to EditController (only customer) - def delete_entities(self, eidtypes): - """delete entities from the repository""" - redirect_info = set() - eidtypes = tuple(eidtypes) - for eid, etype in eidtypes: - entity = self._cw.entity_from_eid(eid, etype) - path, params = entity.after_deletion_path() - redirect_info.add( (path, tuple(params.iteritems())) ) - entity.delete() - if len(redirect_info) > 1: - # In the face of ambiguity, refuse the temptation to guess. - self._after_deletion_path = 'view', () - else: - self._after_deletion_path = iter(redirect_info).next() - if len(eidtypes) > 1: - self._cw.set_message(self._cw._('entities deleted')) - else: - self._cw.set_message(self._cw._('entity deleted')) - def validate_cache(self, view): view.set_http_cache_headers() self._cw.validate_cache() diff -r 4a42d700c52d -r 11899d28337f web/views/editcontroller.py --- a/web/views/editcontroller.py Fri Mar 12 10:52:43 2010 +0100 +++ b/web/views/editcontroller.py Fri Mar 12 10:53:15 2010 +0100 @@ -250,6 +250,25 @@ for reid in seteids: self.relations_rql.append((rql, {'x': eid, 'y': reid}, ('x', 'y'))) + def delete_entities(self, eidtypes): + """delete entities from the repository""" + redirect_info = set() + eidtypes = tuple(eidtypes) + for eid, etype in eidtypes: + entity = self._cw.entity_from_eid(eid, etype) + path, params = entity.after_deletion_path() + redirect_info.add( (path, tuple(params.iteritems())) ) + entity.delete() + if len(redirect_info) > 1: + # In the face of ambiguity, refuse the temptation to guess. + self._after_deletion_path = 'view', () + else: + self._after_deletion_path = iter(redirect_info).next() + if len(eidtypes) > 1: + self._cw.set_message(self._cw._('entities deleted')) + else: + self._cw.set_message(self._cw._('entity deleted')) + def _action_apply(self): self._default_publish() self.reset()