diff --git a/pybossa/core.py b/pybossa/core.py index 72d91f40b..9e4153969 100644 --- a/pybossa/core.py +++ b/pybossa/core.py @@ -584,9 +584,13 @@ def _unauthorized(e): @app.errorhandler(423) def _locked(e): + short_name = request.view_args.get('short_name') + project = project_repo.get_by_shortname(short_name) + owner = project.owner.name response = dict(template='423.html', code=423, private_instance=app.config.get('PRIVATE_INSTANCE'), - description=LOCKED) + description=LOCKED, + owner=owner) return handle_content_type(response) def setup_hooks(app): diff --git a/pybossa/themes/default b/pybossa/themes/default index 53f77435c..eabdf0ecb 160000 --- a/pybossa/themes/default +++ b/pybossa/themes/default @@ -1 +1 @@ -Subproject commit 53f77435c23879bea2c1baf3d4afdcace97890aa +Subproject commit eabdf0ecb46ecdc498a5564a7ef0ed03d24897c3 diff --git a/test/test_web.py b/test/test_web.py index 32c484a37..a6bf471c7 100644 --- a/test/test_web.py +++ b/test/test_web.py @@ -11816,19 +11816,29 @@ def __init__(self, content): class TestErrorHandlers(web.Helper): @with_context - def test_locked_handler(self): + @patch('pybossa.core.project_repo.get_by_shortname') + def test_locked_handler(self, get_by_shortname): setup_error_handlers(self.flask_app) @self.flask_app.route("/locked") def locked_route(): abort(423) + owner_name = "My Project Owner" + admin = UserFactory.create(admin=True, name=owner_name) + get_by_shortname.return_value = ProjectFactory.create(owner=admin) with patch.dict(self.flask_app.config, {'PRIVATE_INSTANCE': True}): res = self.app.get("/locked") + res_str = str(res.data) + assert res.status_code == 423 - assert 'Private GIGwork' in str(res.data) + assert 'Private GIGwork' in res_str + assert owner_name in res_str with patch.dict(self.flask_app.config, {'PRIVATE_INSTANCE': False}): res = self.app.get("/locked") + res_str = str(res.data) + assert res.status_code == 423 assert 'Public GIGwork' in str(res.data) + assert owner_name in res_str