)]}'
{"oslo_middleware/base.py":[{"author":{"_account_id":2472,"name":"Doug Hellmann","email":"dhellmann@redhat.com","username":"doug-hellmann"},"change_message_id":"3c6bd64bde29839dff306f2da36d4c7fe7ecd6b1","unresolved":false,"context_lines":[{"line_number":53,"context_line":"        if response:"},{"line_number":54,"context_line":"            return response"},{"line_number":55,"context_line":"        response \u003d req.get_response(self.application)"},{"line_number":56,"context_line":"        return self.process_response(response, request\u003dreq)"}],"source_content_type":"text/x-python","patch_set":2,"id":"fa32b979_eeb17a90","line":56,"updated":"2015-06-16 18:27:39.000000000","message":"This won\u0027t be backwards-compatible. Any existing middleware that subclasses this base class but provides its own process_response() will fail because it will receive an extra argument. We need to inspect the arguments to process_response() here and only pass request when the callee is expecting it.","commit_id":"65d944a4f117291f3316f83c417a0c5b76f15c6c"},{"author":{"_account_id":2472,"name":"Doug Hellmann","email":"dhellmann@redhat.com","username":"doug-hellmann"},"change_message_id":"c7be3a6d42c1b5e00a6aa1498d87da0d4fb07448","unresolved":false,"context_lines":[{"line_number":53,"context_line":"        if response:"},{"line_number":54,"context_line":"            return response"},{"line_number":55,"context_line":"        response \u003d req.get_response(self.application)"},{"line_number":56,"context_line":"        return self.process_response(response, request\u003dreq)"}],"source_content_type":"text/x-python","patch_set":2,"id":"fa32b979_4172b7ae","line":56,"in_reply_to":"fa32b979_2e13e267","updated":"2015-06-16 18:31:22.000000000","message":"Yes, it *must* be backwards-compatible. We can\u0027t make changes in the library that  break existing code elsewhere.","commit_id":"65d944a4f117291f3316f83c417a0c5b76f15c6c"},{"author":{"_account_id":2472,"name":"Doug Hellmann","email":"dhellmann@redhat.com","username":"doug-hellmann"},"change_message_id":"5ebcad671d7c8e4fbdcfcf5e8c8c0ab184b903c6","unresolved":false,"context_lines":[{"line_number":53,"context_line":"        if response:"},{"line_number":54,"context_line":"            return response"},{"line_number":55,"context_line":"        response \u003d req.get_response(self.application)"},{"line_number":56,"context_line":"        return self.process_response(response, request\u003dreq)"}],"source_content_type":"text/x-python","patch_set":2,"id":"fa32b979_8e4eae94","line":56,"in_reply_to":"fa32b979_eeb17a90","updated":"2015-06-16 18:28:16.000000000","message":"It would be good to have tests for both cases.","commit_id":"65d944a4f117291f3316f83c417a0c5b76f15c6c"},{"author":{"_account_id":9717,"name":"Michael Krotscheck","email":"krotscheck@gmail.com","username":"krotscheck"},"change_message_id":"4f8a3f947f8cddc6adc921c1dccb76e56ff37ad7","unresolved":false,"context_lines":[{"line_number":53,"context_line":"        if response:"},{"line_number":54,"context_line":"            return response"},{"line_number":55,"context_line":"        response \u003d req.get_response(self.application)"},{"line_number":56,"context_line":"        return self.process_response(response, request\u003dreq)"}],"source_content_type":"text/x-python","patch_set":2,"id":"fa32b979_2e13e267","line":56,"in_reply_to":"fa32b979_eeb17a90","updated":"2015-06-16 18:29:36.000000000","message":"Ok... so, should it be backwards compatible?","commit_id":"65d944a4f117291f3316f83c417a0c5b76f15c6c"},{"author":{"_account_id":4190,"name":"lifeless","email":"robertc@robertcollins.net","username":"lifeless"},"change_message_id":"7b8fedea25ee42cd64a0357e9487873963c3a2df","unresolved":false,"context_lines":[{"line_number":57,"context_line":""},{"line_number":58,"context_line":"        (args, varargs, varkw, defaults) \u003d getargspec(self.process_response)"},{"line_number":59,"context_line":"        if \u0027request\u0027 in args:"},{"line_number":60,"context_line":"            return self.process_response(response, request\u003dreq)"},{"line_number":61,"context_line":"        return self.process_response(response)"}],"source_content_type":"text/x-python","patch_set":3,"id":"fa32b979_94fcff72","line":60,"updated":"2015-06-19 04:19:17.000000000","message":"A few thoughts.\n\nFIrstly, \n def process_response(self, **kwargs):\n  ...\nwill fail to be detected by your code. That is, its not going to be a fully robust mechanism.\n\nSecondly, inspect.getargs (which underpins this) is actually rather complex convoluted stuff to be running inline on every request. I wonder if its worth memoising the applicability of this check.\n\nThirdly, aren\u0027t all middlewares in oslo.middleware? I dunno.\n\nLastly, my suggestion here is:\n try:\n     return self.process_response(response, request\u003dreq)\n except TypeError:\n     return self.process_response(response)\n\nWhich will let the normal python method invocation machinery take care of the failure for us (as it gets translated into a TypeError). It does suffer the defect that if something deep down raises TypeError and it bubbles up, we\u0027ll resubmit without req, but nothing is meant to be doing that anyway - so its not common case and the performance impact should as such be tolerable. Idempotency concerns could be raised, since we\u0027d be essentially resubmitting: but again, no WSGI app is meant to ever raise like that anyway, making it a fairly safe thing to do IMO.\n\nWhat do you think?","commit_id":"ecdb1b06c4638fab9816f0dd2278c939d14f5886"}]}
