web/views/basecontrollers.py
branchstable
changeset 7557 a397305f3976
parent 7528 11659cbe5eea
child 7562 cdef82ca9eab
equal deleted inserted replaced
7556:867ec36530b8 7557:a397305f3976
   601     def publish(self, rset=None):
   601     def publish(self, rset=None):
   602         txuuid = self._cw.form['txuuid']
   602         txuuid = self._cw.form['txuuid']
   603         errors = self._cw.cnx.undo_transaction(txuuid)
   603         errors = self._cw.cnx.undo_transaction(txuuid)
   604         if not errors:
   604         if not errors:
   605             self.redirect()
   605             self.redirect()
   606         return self._cw._('some errors occurred:') + self._cw.view(
   606         raise ValidationError(None, {None: '\n'.join(errors)})
   607             'pyvallist', pyvalue=errors)
   607 
   608 
   608     def redirect(self, msg=None):
   609     def redirect(self):
       
   610         req = self._cw
   609         req = self._cw
       
   610         msg = msg or req._("transaction undone")
   611         breadcrumbs = req.session.data.get('breadcrumbs', None)
   611         breadcrumbs = req.session.data.get('breadcrumbs', None)
   612         if breadcrumbs is not None and len(breadcrumbs) > 1:
   612         if breadcrumbs is not None and len(breadcrumbs) > 1:
   613             url = req.rebuild_url(breadcrumbs[-2],
   613             url = req.rebuild_url(breadcrumbs[-2], __message=msg)
   614                                   __message=req._('transaction undoed'))
       
   615         else:
   614         else:
   616             url = req.build_url(__message=req._('transaction undoed'))
   615             url = req.build_url(__message=msg)
   617         raise Redirect(url)
   616         raise Redirect(url)
   618