web/test/unittest_views_errorform.py
branchstable
changeset 8743 27a83746aebd
parent 8695 358d8bed9626
child 9809 29d52a785729
equal deleted inserted replaced
8742:bd374bd906f3 8743:27a83746aebd
    13 # FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public License for more
    13 # FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public License for more
    14 # details.
    14 # details.
    15 #
    15 #
    16 # You should have received a copy of the GNU Lesser General Public License along
    16 # You should have received a copy of the GNU Lesser General Public License along
    17 # with CubicWeb.  If not, see <http://www.gnu.org/licenses/>.
    17 # with CubicWeb.  If not, see <http://www.gnu.org/licenses/>.
    18 
       
    19 from __future__ import with_statement
       
    20 
    18 
    21 from logilab.common.testlib import unittest_main
    19 from logilab.common.testlib import unittest_main
    22 from logilab.mtconverter import html_unescape
    20 from logilab.mtconverter import html_unescape
    23 
    21 
    24 from cubicweb import Forbidden, ValidationError
    22 from cubicweb import Forbidden, ValidationError
    50                 raise ValueError('This is wrong')
    48                 raise ValueError('This is wrong')
    51 
    49 
    52         with self.temporary_appobjects(MyWrongView):
    50         with self.temporary_appobjects(MyWrongView):
    53             try:
    51             try:
    54                 self.view('my-view')
    52                 self.view('my-view')
    55             except Exception, e:
    53             except Exception as e:
    56                 import sys
    54                 import sys
    57                 self.req.data['excinfo'] = sys.exc_info()
    55                 self.req.data['excinfo'] = sys.exc_info()
    58                 self.req.data['ex'] = e
    56                 self.req.data['ex'] = e
    59                 html = self.view('error', req=self.req)
    57                 html = self.view('error', req=self.req)
    60                 self.failUnless(re.search(r'^<input name="__signature" type="hidden" value="[0-9a-f]{32}" />$',
    58                 self.failUnless(re.search(r'^<input name="__signature" type="hidden" value="[0-9a-f]{32}" />$',