)]}'
{"monitoring/alarms/views.py":[{"author":{"_account_id":15027,"name":"Michael Hoppal","email":"michael.jam.hoppal@hpe.com","username":"michael-hoppal"},"change_message_id":"2038b71f710a3f0f7b5a67dea47e7034eb25b0c4","unresolved":false,"context_lines":[{"line_number":114,"context_line":"        limit \u003d 25"},{"line_number":115,"context_line":"        page_offset\u003dself.request.GET.get(\u0027page_offset\u0027)"},{"line_number":116,"context_line":"        contacts \u003d []"},{"line_number":117,"context_line":"        paginator \u003d None"},{"line_number":118,"context_line":"        if page_offset \u003d\u003d None:"},{"line_number":119,"context_line":"            page_offset \u003d 0"},{"line_number":120,"context_line":"        try:"}],"source_content_type":"text/x-python","patch_set":2,"id":"3afb71cf_260e36e5","line":117,"updated":"2015-06-10 21:45:17.000000000","message":"won\u0027t the paginator be set in the try?","commit_id":"9f508776f8d4be91d6bfd28e4aed3782e2579bbb"},{"author":{"_account_id":16170,"name":"Michal Zielonka","email":"michal.zielonka@ts.fujitsu.com","username":"michal.zielonka"},"change_message_id":"5722361c8a85947b6decad5854d142b1200df9c6","unresolved":false,"context_lines":[{"line_number":114,"context_line":"        limit \u003d 25"},{"line_number":115,"context_line":"        page_offset\u003dself.request.GET.get(\u0027page_offset\u0027)"},{"line_number":116,"context_line":"        contacts \u003d []"},{"line_number":117,"context_line":"        paginator \u003d None"},{"line_number":118,"context_line":"        if page_offset \u003d\u003d None:"},{"line_number":119,"context_line":"            page_offset \u003d 0"},{"line_number":120,"context_line":"        try:"}],"source_content_type":"text/x-python","patch_set":2,"id":"3afb71cf_6cb3e44d","line":117,"in_reply_to":"3afb71cf_260e36e5","updated":"2015-06-11 06:00:44.000000000","message":"Not when \nresults \u003d api.monitor.alarm_list(self.request, page_offset, limit)\nwould crash (i.e. any possible reason that goes to Exception catch), then paginator and contacts variables are undefined. \n\nWe cannot return unbound variable, because we will get this exception we posted.","commit_id":"9f508776f8d4be91d6bfd28e4aed3782e2579bbb"},{"author":{"_account_id":11809,"name":"Craig Bryant","email":"craig.bryant@hpe.com","username":"craig-bryant"},"change_message_id":"2e3554d4f3e40e981875b9096fd3f61e705c6706","unresolved":false,"context_lines":[{"line_number":123,"context_line":"            paginator \u003d Paginator(results, limit)"},{"line_number":124,"context_line":"            contacts \u003d paginator.page(1)"},{"line_number":125,"context_line":"        except PageNotAnInteger:"},{"line_number":126,"context_line":"            contacts \u003d paginator.page(1)"},{"line_number":127,"context_line":"        except EmptyPage:"},{"line_number":128,"context_line":"            contacts \u003d paginator.page(paginator.num_pages)"},{"line_number":129,"context_line":"        except Exception:"}],"source_content_type":"text/x-python","patch_set":2,"id":"3afb71cf_6c1404e8","line":126,"updated":"2015-06-11 06:16:05.000000000","message":"paginator.page(1) will fail because paginator is None assuming api.monitor.alarm_list() throws the PageNotAnInteger","commit_id":"9f508776f8d4be91d6bfd28e4aed3782e2579bbb"},{"author":{"_account_id":11809,"name":"Craig Bryant","email":"craig.bryant@hpe.com","username":"craig-bryant"},"change_message_id":"2e3554d4f3e40e981875b9096fd3f61e705c6706","unresolved":false,"context_lines":[{"line_number":125,"context_line":"        except PageNotAnInteger:"},{"line_number":126,"context_line":"            contacts \u003d paginator.page(1)"},{"line_number":127,"context_line":"        except EmptyPage:"},{"line_number":128,"context_line":"            contacts \u003d paginator.page(paginator.num_pages)"},{"line_number":129,"context_line":"        except Exception:"},{"line_number":130,"context_line":"            messages.error(self.request, _(\"Could not retrieve alarms\"))"},{"line_number":131,"context_line":"        return contacts"}],"source_content_type":"text/x-python","patch_set":2,"id":"3afb71cf_0cb3500b","line":128,"updated":"2015-06-11 06:16:05.000000000","message":"paginator.num_pages will fail because paginator is None assuming api.monitor.alarm_list() throws the PageNotAnInteger. What else throws EmptyPage?","commit_id":"9f508776f8d4be91d6bfd28e4aed3782e2579bbb"},{"author":{"_account_id":11809,"name":"Craig Bryant","email":"craig.bryant@hpe.com","username":"craig-bryant"},"change_message_id":"2e3554d4f3e40e981875b9096fd3f61e705c6706","unresolved":false,"context_lines":[{"line_number":127,"context_line":"        except EmptyPage:"},{"line_number":128,"context_line":"            contacts \u003d paginator.page(paginator.num_pages)"},{"line_number":129,"context_line":"        except Exception:"},{"line_number":130,"context_line":"            messages.error(self.request, _(\"Could not retrieve alarms\"))"},{"line_number":131,"context_line":"        return contacts"},{"line_number":132,"context_line":""},{"line_number":133,"context_line":"    def get_context_data(self, **kwargs):"}],"source_content_type":"text/x-python","patch_set":2,"id":"3afb71cf_2cc04c4f","line":130,"updated":"2015-06-11 06:16:05.000000000","message":"I\u0027d rather see this in the Exception clause. That way it is obvious contacts is being set to an empty array when an Exception occurs.\n\ncontacts \u003d []","commit_id":"9f508776f8d4be91d6bfd28e4aed3782e2579bbb"},{"author":{"_account_id":11809,"name":"Craig Bryant","email":"craig.bryant@hpe.com","username":"craig-bryant"},"change_message_id":"2e3554d4f3e40e981875b9096fd3f61e705c6706","unresolved":false,"context_lines":[{"line_number":134,"context_line":"        context \u003d super(AlarmServiceView, self).get_context_data(**kwargs)"},{"line_number":135,"context_line":"        limit \u003d 25"},{"line_number":136,"context_line":"        contacts \u003d []"},{"line_number":137,"context_line":"        paginator \u003d None"},{"line_number":138,"context_line":"        page_offset \u003d self.request.GET.get(\u0027page_offset\u0027)"},{"line_number":139,"context_line":"        if page_offset \u003d\u003d None:"},{"line_number":140,"context_line":"            page_offset \u003d 0"}],"source_content_type":"text/x-python","patch_set":2,"id":"3afb71cf_4c0828da","line":137,"updated":"2015-06-11 06:16:05.000000000","message":"I agree with Michael. If api.monitor.alarm_list throws an exception, then there is a return in the except so paginator and contacts are never used.\n\ncontacts is set in the 2nd try and both except clauses so setting it here obscures the real control flow","commit_id":"9f508776f8d4be91d6bfd28e4aed3782e2579bbb"},{"author":{"_account_id":15027,"name":"Michael Hoppal","email":"michael.jam.hoppal@hpe.com","username":"michael-hoppal"},"change_message_id":"2038b71f710a3f0f7b5a67dea47e7034eb25b0c4","unresolved":false,"context_lines":[{"line_number":134,"context_line":"        context \u003d super(AlarmServiceView, self).get_context_data(**kwargs)"},{"line_number":135,"context_line":"        limit \u003d 25"},{"line_number":136,"context_line":"        contacts \u003d []"},{"line_number":137,"context_line":"        paginator \u003d None"},{"line_number":138,"context_line":"        page_offset \u003d self.request.GET.get(\u0027page_offset\u0027)"},{"line_number":139,"context_line":"        if page_offset \u003d\u003d None:"},{"line_number":140,"context_line":"            page_offset \u003d 0"}],"source_content_type":"text/x-python","patch_set":2,"id":"3afb71cf_c6c2c284","line":137,"updated":"2015-06-10 21:45:17.000000000","message":"why are both of these being set? they will be overridden in the try when this runs.","commit_id":"9f508776f8d4be91d6bfd28e4aed3782e2579bbb"},{"author":{"_account_id":16170,"name":"Michal Zielonka","email":"michal.zielonka@ts.fujitsu.com","username":"michal.zielonka"},"change_message_id":"5722361c8a85947b6decad5854d142b1200df9c6","unresolved":false,"context_lines":[{"line_number":134,"context_line":"        context \u003d super(AlarmServiceView, self).get_context_data(**kwargs)"},{"line_number":135,"context_line":"        limit \u003d 25"},{"line_number":136,"context_line":"        contacts \u003d []"},{"line_number":137,"context_line":"        paginator \u003d None"},{"line_number":138,"context_line":"        page_offset \u003d self.request.GET.get(\u0027page_offset\u0027)"},{"line_number":139,"context_line":"        if page_offset \u003d\u003d None:"},{"line_number":140,"context_line":"            page_offset \u003d 0"}],"source_content_type":"text/x-python","patch_set":2,"id":"3afb71cf_2c884c70","line":137,"in_reply_to":"3afb71cf_c6c2c284","updated":"2015-06-11 06:00:44.000000000","message":"Same reason as above.","commit_id":"9f508776f8d4be91d6bfd28e4aed3782e2579bbb"}]}
