# HG changeset patch # User Thierry Florac # Date 1568714132 -7200 # Node ID 8030eca2abf3eb8876b293189c984870f154c287 # Parent 848706a5100de07baecbfa007cc02c0df287e883 Set form's status correctly in "add_error" method diff -r 848706a5100d -r 8030eca2abf3 src/pyams_form/form.py --- a/src/pyams_form/form.py Wed Aug 28 18:06:20 2019 +0200 +++ b/src/pyams_form/form.py Tue Sep 17 11:55:32 2019 +0200 @@ -207,7 +207,10 @@ snippet.update() widget.error = snippet self.widgets.errors += (snippet,) - self.status = error.args[0] + translate = self.request.localizer.translate + if not self.status: + self.status = translate(self.formErrorsMessage) + self.status += '\n{0}'.format(translate(error.args[0])) def update_content(self, content, data): changes = applyChanges(self, content, data.get(self, data)) @@ -660,10 +663,10 @@ @subscriber(IFormCreatedEvent, context_selector=ISkinnable) def handle_form_skin(event): - request = event.object.request + request = _request = event.object.request if isinstance(request, PyramidPublisherRequest): - request = request._request - skin = ISkinnable(event.object).get_skin(request) + _request = request._request + skin = ISkinnable(event.object).get_skin(_request) if skin is not None: apply_skin(request, skin)