diff --git a/pyproject.toml b/pyproject.toml index 0442f5b..75ad01b 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -44,7 +44,7 @@ dependencies = [ "pyramid_tm", "waitress", "WebHelpers2", - "WuttJamaican[db]>=0.19.0", + "WuttJamaican[db]>=0.19.1", "zope.sqlalchemy>=1.5", ] diff --git a/src/wuttaweb/progress.py b/src/wuttaweb/progress.py index 759c2da..047be83 100644 --- a/src/wuttaweb/progress.py +++ b/src/wuttaweb/progress.py @@ -92,6 +92,9 @@ class SessionProgress(ProgressBase): """ def __init__(self, request, key, success_msg=None, success_url=None, error_url=None): + self.request = request + self.config = self.request.wutta_config + self.app = self.config.get_app() self.key = key self.success_msg = success_msg self.success_url = success_url @@ -137,7 +140,7 @@ class SessionProgress(ProgressBase): """ self.session.load() self.session['error'] = True - self.session['error_msg'] = str(error) + self.session['error_msg'] = self.app.render_error(error) self.session['error_url'] = error_url or self.error_url self.session.save() diff --git a/tests/test_progress.py b/tests/test_progress.py index 8bfce3c..a1e3908 100644 --- a/tests/test_progress.py +++ b/tests/test_progress.py @@ -5,6 +5,8 @@ from unittest import TestCase from pyramid import testing from beaker.session import Session as BeakerSession +from wuttjamaican.testing import ConfigTestCase + from wuttaweb import progress as mod @@ -31,10 +33,11 @@ class TestGetProgressSession(TestCase): self.assertEqual(session.id, 'mockid.progress.foo') -class TestSessionProgress(TestCase): +class TestSessionProgress(ConfigTestCase): def setUp(self): - self.request = testing.DummyRequest() + self.setup_config() + self.request = testing.DummyRequest(wutta_config=self.config) self.request.session.id = 'mockid' def test_error_url(self):