Don't rollback if exception is HTTPSuccessful or HTTPRedirection
In the request finishing, the 'cleanup' callback set by _cw_cnx
automatically commit the transaction except is an exception is set
on the request.
Problem is, redirections and successul http return code can raise
exceptions.
This patch detects such exceptions and avoid rolling back the transaction.
Closes #4566482
import unittest
from pyramid import testing
class ViewTests(unittest.TestCase):
def setUp(self):
self.config = testing.setUp()
def tearDown(self):
testing.tearDown()
def test_my_view(self):
from .views import my_view
request = testing.DummyRequest()
info = my_view(request)
self.assertEqual(info['project'], 'cubi')