Show More
@@ -51,17 +51,10 b' class PylonsErrorHandlingMiddleware(obje' | |||||
51 | response = self.handle_request(request) |
|
51 | response = self.handle_request(request) | |
52 | return response(environ, start_response) |
|
52 | return response(environ, start_response) | |
53 |
|
53 | |||
54 | def is_vcs_response(self, response): |
|
|||
55 | return 'X-RhodeCode-Backend' in response.headers |
|
|||
56 |
|
||||
57 | def is_http_error(self, response): |
|
54 | def is_http_error(self, response): | |
58 | # webob type error responses |
|
55 | # webob type error responses | |
59 | return (400 <= response.status_int <= 599) |
|
56 | return (400 <= response.status_int <= 599) | |
60 |
|
57 | |||
61 | def is_error_handling_needed(self, response): |
|
|||
62 | return (self.is_http_error(response) and not |
|
|||
63 | self.is_vcs_response(response)) |
|
|||
64 |
|
||||
65 | def reraise(self): |
|
58 | def reraise(self): | |
66 | return self._reraise |
|
59 | return self._reraise | |
67 |
|
60 | |||
@@ -77,7 +70,7 b' class PylonsErrorHandlingMiddleware(obje' | |||||
77 | """ |
|
70 | """ | |
78 | try: |
|
71 | try: | |
79 | response = request.get_response(self.app) |
|
72 | response = request.get_response(self.app) | |
80 |
if self.is_error |
|
73 | if self.is_http_error(response): | |
81 | response = webob_to_pyramid_http_response(response) |
|
74 | response = webob_to_pyramid_http_response(response) | |
82 | return self.error_view(response, request) |
|
75 | return self.error_view(response, request) | |
83 | except HTTPError as e: # pyramid type exceptions |
|
76 | except HTTPError as e: # pyramid type exceptions |
General Comments 0
You need to be logged in to leave comments.
Login now