# HG changeset patch # User Julien Jehannet # Date 1308817480 -7200 # Node ID a397305f3976c26ab30e6446ec43f322b1d0eb67 # Parent 867ec36530b8912c07be65d4da615e0270ca8f70 [controller] UndoController: fix output method (closes: #1776091) Fix buggy direct output in `UndoController.publish()`. Raise now a ValidationError instead of malformed string Changes: * raise ValidationError when an error occured in undo * use the new message mechanism based on _cwmsgid If errors are not fatal, you have to change publish() method. diff -r 867ec36530b8 -r a397305f3976 i18n/fr.po --- a/i18n/fr.po Fri Jun 24 14:10:37 2011 +0200 +++ b/i18n/fr.po Thu Jun 23 10:24:40 2011 +0200 @@ -4,7 +4,7 @@ msgid "" msgstr "" "Project-Id-Version: cubicweb 2.46.0\n" -"PO-Revision-Date: 2011-01-03 14:35+0100\n" +"PO-Revision-Date: 2011-06-23 10:23+0200\n" "Last-Translator: Logilab Team \n" "Language-Team: fr \n" "Language: \n" @@ -4077,7 +4077,7 @@ msgstr "n° de transition" msgid "transaction undone" -msgstr "transaction annulées" +msgstr "transaction annulée" #, python-format msgid "transition %(tr)s isn't allowed from %(st)s" diff -r 867ec36530b8 -r a397305f3976 web/views/basecontrollers.py --- a/web/views/basecontrollers.py Fri Jun 24 14:10:37 2011 +0200 +++ b/web/views/basecontrollers.py Thu Jun 23 10:24:40 2011 +0200 @@ -603,16 +603,14 @@ errors = self._cw.cnx.undo_transaction(txuuid) if not errors: self.redirect() - return self._cw._('some errors occurred:') + self._cw.view( - 'pyvallist', pyvalue=errors) + raise ValidationError(None, {None: '\n'.join(errors)}) - def redirect(self): + def redirect(self, msg=None): req = self._cw + msg = msg or req._("transaction undone") breadcrumbs = req.session.data.get('breadcrumbs', None) if breadcrumbs is not None and len(breadcrumbs) > 1: - url = req.rebuild_url(breadcrumbs[-2], - __message=req._('transaction undoed')) + url = req.rebuild_url(breadcrumbs[-2], __message=msg) else: - url = req.build_url(__message=req._('transaction undoed')) + url = req.build_url(__message=msg) raise Redirect(url) -