To accomplish something similar, i use a mix of custom exceptions and
pyramid's exception handling.
I have a class in my exceptions.py like this...
class ViewExceptionJsonForm(Exception):
def __init__(self, ... ):
... setup with args, which might contain the Form, a Wrapped
Am Fr., 11. Jan. 2019 um 05:57 Uhr schrieb Mike Orr :
> Is there a simple way to convert a Response to an HTTP string; i.e.,
> with headers and a body like it would send to the client?
>
> I have a JSON backend view that sends an HTTP exception like this:
>
> # HTTP 422, simulating a validation