72 request.response.status_int = 200 |
72 request.response.status_int = 200 |
73 except cubicweb.web.ValidationError as ex: |
73 except cubicweb.web.ValidationError as ex: |
74 # XXX The validation_error_handler implementation is light, we |
74 # XXX The validation_error_handler implementation is light, we |
75 # should redo it better in cw_to_pyramid, so it can be properly |
75 # should redo it better in cw_to_pyramid, so it can be properly |
76 # handled when raised from a cubicweb view. |
76 # handled when raised from a cubicweb view. |
|
77 # BUT the real handling of validation errors should be done |
|
78 # earlier in the controllers, not here. In the end, the |
|
79 # ValidationError should never by handled here. |
77 content = self.appli.validation_error_handler(req, ex) |
80 content = self.appli.validation_error_handler(req, ex) |
78 except cubicweb.web.RemoteCallFailed as ex: |
81 except cubicweb.web.RemoteCallFailed as ex: |
79 # XXX The default pyramid error handler (or one that we provide |
82 # XXX The default pyramid error handler (or one that we provide |
80 # for this exception) should be enough |
83 # for this exception) should be enough |
81 # content = self.appli.ajax_error_handler(req, ex) |
84 # content = self.appli.ajax_error_handler(req, ex) |
82 raise |
85 raise |
83 |
86 |
84 if content is not None: |
87 if content is not None: |
85 request.response.body = content |
88 request.response.body = content |
86 |
89 |
|
90 # XXX CubicWebPyramidRequest.headers_out should |
|
91 # access directly the pyramid response headers. |
87 request.response.headers.clear() |
92 request.response.headers.clear() |
88 |
|
89 for k, v in req.headers_out.getAllRawHeaders(): |
93 for k, v in req.headers_out.getAllRawHeaders(): |
90 for item in v: |
94 for item in v: |
91 request.response.headers.add(k, item) |
95 request.response.headers.add(k, item) |
92 |
96 |
93 except LogOut as ex: |
97 except LogOut as ex: |