Mercurial > libervia-web
comparison libervia/server/pages.py @ 1338:9bfd2d0661b2
pages: fixed handling of DataError when posting data
author | Goffi <goffi@goffi.org> |
---|---|
date | Sat, 15 Aug 2020 23:28:44 +0200 |
parents | 898442c4ff68 |
children | 25104d31479f |
comparison
equal
deleted
inserted
replaced
1337:f0648005cd11 | 1338:9bfd2d0661b2 |
---|---|
1492 ret = await asDeferred(self.on_data_post, self, request) | 1492 ret = await asDeferred(self.on_data_post, self, request) |
1493 except exceptions.DataError as e: | 1493 except exceptions.DataError as e: |
1494 # something is wrong with the posted data, we re-display the page with a | 1494 # something is wrong with the posted data, we re-display the page with a |
1495 # warning notification | 1495 # warning notification |
1496 session_data = self.host.getSessionData(request, session_iface.ISATSession) | 1496 session_data = self.host.getSessionData(request, session_iface.ISATSession) |
1497 session_data.setPageNotification(self, e.value.message, C.LVL_WARNING) | 1497 session_data.setPageNotification(self, str(e), C.LVL_WARNING) |
1498 request.setResponseCode(C.HTTP_SEE_OTHER) | 1498 request.setResponseCode(C.HTTP_SEE_OTHER) |
1499 request.setHeader("location", request.uri) | 1499 request.setHeader("location", request.uri) |
1500 request.finish() | 1500 request.finish() |
1501 raise failure.Failure(exceptions.CancelError("Post/Redirect/Get is used")) | 1501 raise failure.Failure(exceptions.CancelError("Post/Redirect/Get is used")) |
1502 else: | 1502 else: |