web/views/basecontrollers.py
changeset 4913 083b4d454192
parent 4894 41c28ddca055
child 4914 dcb055f32d9b
equal deleted inserted replaced
4912:9767cc516b4f 4913:083b4d454192
   603         body = self._cw.form['description']
   603         body = self._cw.form['description']
   604         self.sendmail(self._cw.config['submit-mail'], _('%s error report') % self._cw.config.appid, body)
   604         self.sendmail(self._cw.config['submit-mail'], _('%s error report') % self._cw.config.appid, body)
   605         url = self._cw.build_url(__message=self._cw._('bug report sent'))
   605         url = self._cw.build_url(__message=self._cw._('bug report sent'))
   606         raise Redirect(url)
   606         raise Redirect(url)
   607 
   607 
       
   608 
       
   609 class UndoController(SendMailController):
       
   610     __regid__ = 'undo'
       
   611     __select__ = authenticated_user() & match_form_params('txuuid')
       
   612 
       
   613     def publish(self, rset=None):
       
   614         txuuid = self._cw.form['txuuid']
       
   615         errors = self._cw.cnx.undo_transaction(txuuid)
       
   616         if errors:
       
   617             self.w(self._cw._('some errors occured:'))
       
   618             self.wview('pyvalist', pyvalue=errors)
       
   619         else:
       
   620             self.redirect()
       
   621 
       
   622     def redirect(self):
       
   623         req = self._cw
       
   624         breadcrumbs = req.get_session_data('breadcrumbs', None)
       
   625         if breadcrumbs is not None and len(breadcrumbs) > 1:
       
   626             url = req.rebuild_url(breadcrumbs[-2],
       
   627                                   __message=req._('transaction undoed'))
       
   628         else:
       
   629             url = req.build_url(__message=req._('transaction undoed'))
       
   630         raise Redirect(url)
       
   631