WIP: on replacing RESPONSE.write + raise
Besides the issue that was fixed in 2617d934, the commit in this MR is about other similar cases, but it seems they don't even work well with Medusa. In addition to the error message following the returned data when using WSGI, I think there are other things to clarify:
- status code: I guess we always get 500 here, but that does not look correct and we should set status with lock, like in erp5_hal_json_style's Base_redirect
- error log: shouldn't we avoid filling the error log (and waste time generating a error page), which is doable by raising Redirect (which anyway imply to set status explicitly, since a redirect status is clearly wrong)
- content type: generating an error page via the error hook (standard_error_message) usually overrides the content type with text/html, which can be another to reason to raise Redirect (waiting for something better)
Note that this MR is only to decide the behaviour we want, and for the moment we'd use workarounds to do that. Proper implementation will be done in a separate MR.