)]}'
{"ceilometer/api/controllers/v2.py":[{"author":{"_account_id":2472,"name":"Doug Hellmann","email":"dhellmann@redhat.com","username":"doug-hellmann"},"change_message_id":"b35eb659e008251068d7cb824f1005a5f72f7a8a","unresolved":false,"context_lines":[{"line_number":284,"context_line":"                rel\u003drel_name)"},{"line_number":285,"context_line":""},{"line_number":286,"context_line":""},{"line_number":287,"context_line":"class MarkerPairs(_Base):"},{"line_number":288,"context_line":"    \"\"\"marker pairs to identify the marker object."},{"line_number":289,"context_line":"    \"\"\""},{"line_number":290,"context_line":""}],"source_content_type":"text/x-python","patch_set":7,"id":"AAAAP3%2F%2Fskg%3D","line":287,"updated":"2013-07-12 21:06:50.000000000","message":"This class represents a single pair, so it should be called MarkerPair.","commit_id":"1069e382608d8c7265cd2610ce008544b4340f43"},{"author":{"_account_id":2472,"name":"Doug Hellmann","email":"dhellmann@redhat.com","username":"doug-hellmann"},"change_message_id":"b35eb659e008251068d7cb824f1005a5f72f7a8a","unresolved":false,"context_lines":[{"line_number":308,"context_line":"    for i in marker_pairs:"},{"line_number":309,"context_line":"        if hasattr(db_model, i.field):"},{"line_number":310,"context_line":"            tmp_pairs \u003d {i.field: i.value}"},{"line_number":311,"context_line":"            ret_pairs \u003d dict(ret_pairs.items() + tmp_pairs.items())"},{"line_number":312,"context_line":"        else:"},{"line_number":313,"context_line":"            LOG.warn(\u0027db_model %s has no attribute %s\u0027 % (db_model, i.field))"},{"line_number":314,"context_line":"    return ret_pairs"}],"source_content_type":"text/x-python","patch_set":7,"id":"AAAAP3%2F%2FsjU%3D","line":311,"updated":"2013-07-12 21:06:50.000000000","message":"This looks like an odd way to build up a dictionary. Why not just say:\n\n  ret_pairs[i.field] \u003d i.value","commit_id":"1069e382608d8c7265cd2610ce008544b4340f43"},{"author":{"_account_id":2472,"name":"Doug Hellmann","email":"dhellmann@redhat.com","username":"doug-hellmann"},"change_message_id":"b35eb659e008251068d7cb824f1005a5f72f7a8a","unresolved":false,"context_lines":[{"line_number":310,"context_line":"            tmp_pairs \u003d {i.field: i.value}"},{"line_number":311,"context_line":"            ret_pairs \u003d dict(ret_pairs.items() + tmp_pairs.items())"},{"line_number":312,"context_line":"        else:"},{"line_number":313,"context_line":"            LOG.warn(\u0027db_model %s has no attribute %s\u0027 % (db_model, i.field))"},{"line_number":314,"context_line":"    return ret_pairs"},{"line_number":315,"context_line":""},{"line_number":316,"context_line":""}],"source_content_type":"text/x-python","patch_set":7,"id":"AAAAP3%2F%2Fsjo%3D","line":313,"updated":"2013-07-12 21:06:50.000000000","message":"This should raise an exception so that the user realizes they have passed an invalid value.","commit_id":"1069e382608d8c7265cd2610ce008544b4340f43"},{"author":{"_account_id":2472,"name":"Doug Hellmann","email":"dhellmann@redhat.com","username":"doug-hellmann"},"change_message_id":"b35eb659e008251068d7cb824f1005a5f72f7a8a","unresolved":false,"context_lines":[{"line_number":646,"context_line":"    def _lookup(self, meter_id, *remainder):"},{"line_number":647,"context_line":"        return MeterController(meter_id), remainder"},{"line_number":648,"context_line":""},{"line_number":649,"context_line":"    @wsme_pecan.wsexpose([Meter], [Query], int, [MarkerPairs], str, str)"},{"line_number":650,"context_line":"    def get_all(self, q\u003d[], limit\u003dNone, markers\u003d[], sort_key\u003dNone,"},{"line_number":651,"context_line":"                sort_dir\u003dNone):"},{"line_number":652,"context_line":"        \"\"\"Return all known meters, based on the data recorded so far."}],"source_content_type":"text/x-python","patch_set":7,"id":"AAAAP3%2F%2FskI%3D","line":649,"updated":"2013-07-12 21:06:50.000000000","message":"Please use wstypes.text instead of str, to ensure unicode support.","commit_id":"1069e382608d8c7265cd2610ce008544b4340f43"},{"author":{"_account_id":2472,"name":"Doug Hellmann","email":"dhellmann@redhat.com","username":"doug-hellmann"},"change_message_id":"b35eb659e008251068d7cb824f1005a5f72f7a8a","unresolved":false,"context_lines":[{"line_number":652,"context_line":"        \"\"\"Return all known meters, based on the data recorded so far."},{"line_number":653,"context_line":""},{"line_number":654,"context_line":"        :param q: Filter rules for the meters to be returned."},{"line_number":655,"context_line":"        :param limit: Maximum number of items to return."},{"line_number":656,"context_line":"        :param markers: Attribute-value paris that help to identify"},{"line_number":657,"context_line":"                        the last item of the previous page; we return"},{"line_number":658,"context_line":"                        the next results after this item."}],"source_content_type":"text/x-python","patch_set":7,"id":"AAAAP3%2F%2Fsi8%3D","line":655,"updated":"2013-07-12 21:06:50.000000000","message":"Does it make sense to use only some of these parameters? For example, can I pass a sort_dir and sort_key without specifying a limit and get a useful response?\n\nShould limit have a non-zero default to cut down on the amount of data we are processing in any one call?\n\nHow does the user know what values to pass for the marker pairs? How do they know which fields are unique enough to represent a good marker? Can we figure that out for them somehow?","commit_id":"1069e382608d8c7265cd2610ce008544b4340f43"},{"author":{"_account_id":7642,"name":"Fengqian Gao","email":"fengqian.gao@intel.com","username":"Fengqian"},"change_message_id":"656f1cad6522bbc686a19719ae34edf3feb8ad1a","unresolved":false,"context_lines":[{"line_number":652,"context_line":"        \"\"\"Return all known meters, based on the data recorded so far."},{"line_number":653,"context_line":""},{"line_number":654,"context_line":"        :param q: Filter rules for the meters to be returned."},{"line_number":655,"context_line":"        :param limit: Maximum number of items to return."},{"line_number":656,"context_line":"        :param markers: Attribute-value paris that help to identify"},{"line_number":657,"context_line":"                        the last item of the previous page; we return"},{"line_number":658,"context_line":"                        the next results after this item."}],"source_content_type":"text/x-python","patch_set":7,"id":"AAAAP3%2F%2FqHI%3D","line":655,"in_reply_to":"AAAAP3%2F%2Fsi8%3D","updated":"2013-07-15 10:47:04.000000000","message":"You can pass sort_key and sort_dir without specify limit or markers. It will sort all results with the passed key and direction. For limit parameter, i would not prefer to set a default value, because we did not know the actual number of the query results, then what the default number should we set? \n\nNow, i assume that user should know which fields are good to find the marker. Because the marker is just the last item of previous page.  If user does not know that well, he can pass more than one field-value pair to identify a unique marker. If we can not find a unique marker, a error will raised in _get_marker() in impl_mongo.py","commit_id":"1069e382608d8c7265cd2610ce008544b4340f43"},{"author":{"_account_id":2472,"name":"Doug Hellmann","email":"dhellmann@redhat.com","username":"doug-hellmann"},"change_message_id":"b35eb659e008251068d7cb824f1005a5f72f7a8a","unresolved":false,"context_lines":[{"line_number":657,"context_line":"                        the last item of the previous page; we return"},{"line_number":658,"context_line":"                        the next results after this item."},{"line_number":659,"context_line":"        :params sort_key: Attribute by which results be sorted."},{"line_number":660,"context_line":"        :params sort_dir: Direction with which results be sorted(asc, desc)."},{"line_number":661,"context_line":"        \"\"\""},{"line_number":662,"context_line":"        kwargs \u003d _query_to_kwargs(q, pecan.request.storage_conn.get_meters)"},{"line_number":663,"context_line":"        ret_pairs \u003d None"}],"source_content_type":"text/x-python","patch_set":7,"id":"AAAAP3%2F%2Fsi4%3D","line":660,"updated":"2013-07-12 21:06:50.000000000","message":"If sort_dir can only have one of those two values, it should be defined as an Enum so WSME will do the validation for us.","commit_id":"1069e382608d8c7265cd2610ce008544b4340f43"},{"author":{"_account_id":2472,"name":"Doug Hellmann","email":"dhellmann@redhat.com","username":"doug-hellmann"},"change_message_id":"b35eb659e008251068d7cb824f1005a5f72f7a8a","unresolved":false,"context_lines":[{"line_number":661,"context_line":"        \"\"\""},{"line_number":662,"context_line":"        kwargs \u003d _query_to_kwargs(q, pecan.request.storage_conn.get_meters)"},{"line_number":663,"context_line":"        ret_pairs \u003d None"},{"line_number":664,"context_line":"        if len(markers) \u003e 0:"},{"line_number":665,"context_line":"            ret_pairs \u003d _get_marker_pairs(markers, Meter)"},{"line_number":666,"context_line":"        return [Meter.from_db_model(m)"},{"line_number":667,"context_line":"                for m in pecan.request.storage_conn.get_meters(limit\u003dlimit,"}],"source_content_type":"text/x-python","patch_set":7,"id":"AAAAP3%2F%2Fsiw%3D","line":664,"updated":"2013-07-12 21:06:50.000000000","message":"This results in passing None to the storage driver sometimes and a list other times. What\u0027s wrong with just computing the list and passing that, even if it happens to be empty?","commit_id":"1069e382608d8c7265cd2610ce008544b4340f43"},{"author":{"_account_id":7642,"name":"Fengqian Gao","email":"fengqian.gao@intel.com","username":"Fengqian"},"change_message_id":"656f1cad6522bbc686a19719ae34edf3feb8ad1a","unresolved":false,"context_lines":[{"line_number":661,"context_line":"        \"\"\""},{"line_number":662,"context_line":"        kwargs \u003d _query_to_kwargs(q, pecan.request.storage_conn.get_meters)"},{"line_number":663,"context_line":"        ret_pairs \u003d None"},{"line_number":664,"context_line":"        if len(markers) \u003e 0:"},{"line_number":665,"context_line":"            ret_pairs \u003d _get_marker_pairs(markers, Meter)"},{"line_number":666,"context_line":"        return [Meter.from_db_model(m)"},{"line_number":667,"context_line":"                for m in pecan.request.storage_conn.get_meters(limit\u003dlimit,"}],"source_content_type":"text/x-python","patch_set":7,"id":"AAAAP3%2F%2FqG0%3D","line":664,"in_reply_to":"AAAAP3%2F%2Fsiw%3D","updated":"2013-07-15 10:47:04.000000000","message":"i have changed the code. we can pass the empty marker here, but we could not find a actual marker object using collection.find_one(). So in impl_mongodb.py file, function _get_marker will return None. At last the collection will return all the results then.","commit_id":"1069e382608d8c7265cd2610ce008544b4340f43"},{"author":{"_account_id":2472,"name":"Doug Hellmann","email":"dhellmann@redhat.com","username":"doug-hellmann"},"change_message_id":"b35eb659e008251068d7cb824f1005a5f72f7a8a","unresolved":false,"context_lines":[{"line_number":750,"context_line":"        return Resource.from_db_and_links(resources[0],"},{"line_number":751,"context_line":"                                          self._resource_links(resource_id))"},{"line_number":752,"context_line":""},{"line_number":753,"context_line":"    @wsme_pecan.wsexpose([Resource], [Query], int, [MarkerPairs], str, str)"},{"line_number":754,"context_line":"    def get_all(self, q\u003d[], limit\u003dNone, markers\u003d[], sort_key\u003dNone,"},{"line_number":755,"context_line":"                sort_dir\u003dNone):"},{"line_number":756,"context_line":"        \"\"\"Retrieve definitions of all of the resources."}],"source_content_type":"text/x-python","patch_set":7,"id":"AAAAP3%2F%2Fsj4%3D","line":753,"updated":"2013-07-12 21:06:50.000000000","message":"See earlier comment about types.","commit_id":"1069e382608d8c7265cd2610ce008544b4340f43"},{"author":{"_account_id":2472,"name":"Doug Hellmann","email":"dhellmann@redhat.com","username":"doug-hellmann"},"change_message_id":"b35eb659e008251068d7cb824f1005a5f72f7a8a","unresolved":false,"context_lines":[{"line_number":954,"context_line":""},{"line_number":955,"context_line":"        return Alarm.from_db_model(alarms[0])"},{"line_number":956,"context_line":""},{"line_number":957,"context_line":"    @wsme_pecan.wsexpose([Alarm], [Query], int, [MarkerPairs], str, str)"},{"line_number":958,"context_line":"    def get_all(self, q\u003d[], limit\u003dNone, markers\u003d[], sort_key\u003dNone,"},{"line_number":959,"context_line":"                sort_dir\u003dNone):"},{"line_number":960,"context_line":"        \"\"\"Return all alarms, based on the query provided."}],"source_content_type":"text/x-python","patch_set":7,"id":"AAAAP3%2F%2Fsj0%3D","line":957,"updated":"2013-07-12 21:06:50.000000000","message":"Same","commit_id":"1069e382608d8c7265cd2610ce008544b4340f43"},{"author":{"_account_id":1669,"name":"Julien Danjou","display_name":"jd","email":"julien@danjou.info","username":"jdanjou"},"change_message_id":"aa86b876f29277b3144228b2267e222feeec4426","unresolved":false,"context_lines":[{"line_number":654,"context_line":""},{"line_number":655,"context_line":"        :param q: Filter rules for the meters to be returned."},{"line_number":656,"context_line":"        :param limit: Maximum number of items to return."},{"line_number":657,"context_line":"        :param markers: Attribute-value paris that help to identify"},{"line_number":658,"context_line":"                        the last item of the previous page; we return"},{"line_number":659,"context_line":"                        the next results after this item."},{"line_number":660,"context_line":"        :params sort_key: Attribute by which results be sorted."}],"source_content_type":"text/x-python","patch_set":8,"id":"AAAAP3%2F%2Fo6c%3D","line":657,"updated":"2013-07-15 14:46:22.000000000","message":"s/paris/pairs/","commit_id":"418c618d53bd62772b00b06eb447e0facc8b1f9e"},{"author":{"_account_id":1669,"name":"Julien Danjou","display_name":"jd","email":"julien@danjou.info","username":"jdanjou"},"change_message_id":"aa86b876f29277b3144228b2267e222feeec4426","unresolved":false,"context_lines":[{"line_number":657,"context_line":"        :param markers: Attribute-value paris that help to identify"},{"line_number":658,"context_line":"                        the last item of the previous page; we return"},{"line_number":659,"context_line":"                        the next results after this item."},{"line_number":660,"context_line":"        :params sort_key: Attribute by which results be sorted."},{"line_number":661,"context_line":"        :params sort_dir: Direction with which results be sorted(asc, desc)."},{"line_number":662,"context_line":"        \"\"\""},{"line_number":663,"context_line":"        kwargs \u003d _query_to_kwargs(q, pecan.request.storage_conn.get_meters)"}],"source_content_type":"text/x-python","patch_set":8,"id":"AAAAP3%2F%2Fo6Y%3D","line":660,"updated":"2013-07-15 14:46:22.000000000","message":"s/be/are/","commit_id":"418c618d53bd62772b00b06eb447e0facc8b1f9e"},{"author":{"_account_id":1669,"name":"Julien Danjou","display_name":"jd","email":"julien@danjou.info","username":"jdanjou"},"change_message_id":"aa86b876f29277b3144228b2267e222feeec4426","unresolved":false,"context_lines":[{"line_number":658,"context_line":"                        the last item of the previous page; we return"},{"line_number":659,"context_line":"                        the next results after this item."},{"line_number":660,"context_line":"        :params sort_key: Attribute by which results be sorted."},{"line_number":661,"context_line":"        :params sort_dir: Direction with which results be sorted(asc, desc)."},{"line_number":662,"context_line":"        \"\"\""},{"line_number":663,"context_line":"        kwargs \u003d _query_to_kwargs(q, pecan.request.storage_conn.get_meters)"},{"line_number":664,"context_line":"        ret_pairs \u003d None"}],"source_content_type":"text/x-python","patch_set":8,"id":"AAAAP3%2F%2Fo6A%3D","line":661,"updated":"2013-07-15 14:46:22.000000000","message":"Directions used to sort results (asc, desc).","commit_id":"418c618d53bd62772b00b06eb447e0facc8b1f9e"},{"author":{"_account_id":1669,"name":"Julien Danjou","display_name":"jd","email":"julien@danjou.info","username":"jdanjou"},"change_message_id":"aa86b876f29277b3144228b2267e222feeec4426","unresolved":false,"context_lines":[{"line_number":667,"context_line":"        if sort_dir is not None:"},{"line_number":668,"context_line":"            sort_dir_op \u003d sort_dir_kind.validate(sort_dir)"},{"line_number":669,"context_line":"        return [Meter.from_db_model(m)"},{"line_number":670,"context_line":"                for m in pecan.request.storage_conn.get_meters(limit\u003dlimit,"},{"line_number":671,"context_line":"                                                               marker_pairs\u003d"},{"line_number":672,"context_line":"                                                               ret_pairs,"},{"line_number":673,"context_line":"                                                               sort_key\u003d"}],"source_content_type":"text/x-python","patch_set":8,"id":"AAAAP3%2F%2Fo54%3D","line":670,"updated":"2013-07-15 14:46:22.000000000","message":"Insert a \\n after the (\nthe code will be more readble.","commit_id":"418c618d53bd62772b00b06eb447e0facc8b1f9e"},{"author":{"_account_id":1669,"name":"Julien Danjou","display_name":"jd","email":"julien@danjou.info","username":"jdanjou"},"change_message_id":"aa86b876f29277b3144228b2267e222feeec4426","unresolved":false,"context_lines":[{"line_number":765,"context_line":"                        the last item of the previous page; we return"},{"line_number":766,"context_line":"                        the next results after this item."},{"line_number":767,"context_line":"        :params sort_key: Attribute by which results be sorted."},{"line_number":768,"context_line":"        :params sort_dir: Direction with which results be sorted(asc, desc)."},{"line_number":769,"context_line":"        \"\"\""},{"line_number":770,"context_line":"        kwargs \u003d _query_to_kwargs(q, pecan.request.storage_conn.get_resources)"},{"line_number":771,"context_line":"        ret_pairs \u003d None"}],"source_content_type":"text/x-python","patch_set":8,"id":"AAAAP3%2F%2Fo50%3D","line":768,"updated":"2013-07-15 14:46:22.000000000","message":"Same changes on the docstring as previously.","commit_id":"418c618d53bd62772b00b06eb447e0facc8b1f9e"},{"author":{"_account_id":1669,"name":"Julien Danjou","display_name":"jd","email":"julien@danjou.info","username":"jdanjou"},"change_message_id":"aa86b876f29277b3144228b2267e222feeec4426","unresolved":false,"context_lines":[{"line_number":776,"context_line":"        resources \u003d ["},{"line_number":777,"context_line":"            Resource.from_db_and_links(r,"},{"line_number":778,"context_line":"                                       self._resource_links(r.resource_id))"},{"line_number":779,"context_line":"            for r in pecan.request.storage_conn.get_resources(limit\u003dlimit,"},{"line_number":780,"context_line":"                                                              marker_pairs\u003d"},{"line_number":781,"context_line":"                                                              ret_pairs,"},{"line_number":782,"context_line":"                                                              sort_key\u003d"}],"source_content_type":"text/x-python","patch_set":8,"id":"AAAAP3%2F%2Fo5w%3D","line":779,"updated":"2013-07-15 14:46:22.000000000","message":"Insert \\n","commit_id":"418c618d53bd62772b00b06eb447e0facc8b1f9e"},{"author":{"_account_id":1669,"name":"Julien Danjou","display_name":"jd","email":"julien@danjou.info","username":"jdanjou"},"change_message_id":"aa86b876f29277b3144228b2267e222feeec4426","unresolved":false,"context_lines":[{"line_number":972,"context_line":"                        the last item of the previous page; we return"},{"line_number":973,"context_line":"                        the next results after this item."},{"line_number":974,"context_line":"        :params sort_key: Attribute by which results be sorted."},{"line_number":975,"context_line":"        :params sort_dir: Direction with which results be sorted(asc, desc)."},{"line_number":976,"context_line":"        \"\"\""},{"line_number":977,"context_line":"        kwargs \u003d _query_to_kwargs(q,"},{"line_number":978,"context_line":"                                  pecan.request.storage_conn.get_alarms)"}],"source_content_type":"text/x-python","patch_set":8,"id":"AAAAP3%2F%2Fo5Q%3D","line":975,"updated":"2013-07-15 14:46:22.000000000","message":"Same.","commit_id":"418c618d53bd62772b00b06eb447e0facc8b1f9e"},{"author":{"_account_id":1669,"name":"Julien Danjou","display_name":"jd","email":"julien@danjou.info","username":"jdanjou"},"change_message_id":"aa86b876f29277b3144228b2267e222feeec4426","unresolved":false,"context_lines":[{"line_number":982,"context_line":"        if sort_dir is not None:"},{"line_number":983,"context_line":"            sort_dir_op \u003d sort_dir_kind.validate(sort_dir)"},{"line_number":984,"context_line":"        return [Alarm.from_db_model(m)"},{"line_number":985,"context_line":"                for m in pecan.request.storage_conn.get_alarms(limit\u003dlimit,"},{"line_number":986,"context_line":"                                                               marker_pairs\u003d"},{"line_number":987,"context_line":"                                                               ret_pairs,"},{"line_number":988,"context_line":"                                                               sort_key\u003d"}],"source_content_type":"text/x-python","patch_set":8,"id":"AAAAP3%2F%2Fo5I%3D","line":985,"updated":"2013-07-15 14:46:22.000000000","message":"Same.","commit_id":"418c618d53bd62772b00b06eb447e0facc8b1f9e"}],"ceilometer/storage/base.py":[{"author":{"_account_id":2472,"name":"Doug Hellmann","email":"dhellmann@redhat.com","username":"doug-hellmann"},"change_message_id":"b35eb659e008251068d7cb824f1005a5f72f7a8a","unresolved":false,"context_lines":[{"line_number":101,"context_line":"                      start_timestamp\u003dNone, start_timestamp_op\u003dNone,"},{"line_number":102,"context_line":"                      end_timestamp\u003dNone, end_timestamp_op\u003dNone,"},{"line_number":103,"context_line":"                      metaquery\u003d{}, resource\u003dNone, limit\u003dNone,"},{"line_number":104,"context_line":"                      marker_pairs\u003dNone, sort_key\u003dNone, sort_dir\u003dNone):"},{"line_number":105,"context_line":"        \"\"\"Return an iterable of models.Resource instances containing"},{"line_number":106,"context_line":"        resource information."},{"line_number":107,"context_line":""}],"source_content_type":"text/x-python","patch_set":7,"id":"AAAAP3%2F%2FsiA%3D","line":104,"updated":"2013-07-12 21:06:50.000000000","message":"These methods have a lot of arguments already. Does it make sense to group the new options together in a class, since they are \"meta properties\" of the query, rather than data filters?","commit_id":"1069e382608d8c7265cd2610ce008544b4340f43"},{"author":{"_account_id":7642,"name":"Fengqian Gao","email":"fengqian.gao@intel.com","username":"Fengqian"},"change_message_id":"656f1cad6522bbc686a19719ae34edf3feb8ad1a","unresolved":false,"context_lines":[{"line_number":101,"context_line":"                      start_timestamp\u003dNone, start_timestamp_op\u003dNone,"},{"line_number":102,"context_line":"                      end_timestamp\u003dNone, end_timestamp_op\u003dNone,"},{"line_number":103,"context_line":"                      metaquery\u003d{}, resource\u003dNone, limit\u003dNone,"},{"line_number":104,"context_line":"                      marker_pairs\u003dNone, sort_key\u003dNone, sort_dir\u003dNone):"},{"line_number":105,"context_line":"        \"\"\"Return an iterable of models.Resource instances containing"},{"line_number":106,"context_line":"        resource information."},{"line_number":107,"context_line":""}],"source_content_type":"text/x-python","patch_set":7,"id":"AAAAP3%2F%2FpwA%3D","line":104,"in_reply_to":"AAAAP3%2F%2FsiA%3D","updated":"2013-07-15 10:47:04.000000000","message":"Is it necessary to do that? I want to keep in line with other methods, shall we put it in low priority for now?","commit_id":"1069e382608d8c7265cd2610ce008544b4340f43"},{"author":{"_account_id":1669,"name":"Julien Danjou","display_name":"jd","email":"julien@danjou.info","username":"jdanjou"},"change_message_id":"aa86b876f29277b3144228b2267e222feeec4426","unresolved":false,"context_lines":[{"line_number":114,"context_line":"        :param end_timestamp_op: Optional timestamp end range operation."},{"line_number":115,"context_line":"        :param metaquery: Optional dict with metadata to match on."},{"line_number":116,"context_line":"        :param resource: Optional resource filter."},{"line_number":117,"context_line":"        :param limit: Number of documents should be returned."},{"line_number":118,"context_line":"        :param marker_pairs: Attribute-value pairs to identify the last item of"},{"line_number":119,"context_line":"                            the previous page."},{"line_number":120,"context_line":"        :param sort_key: Attribute by which results be sorted"}],"source_content_type":"text/x-python","patch_set":8,"id":"AAAAP3%2F%2Fo40%3D","line":117,"updated":"2013-07-15 14:46:22.000000000","message":"\"Maximum number of resources that should be returned.","commit_id":"418c618d53bd62772b00b06eb447e0facc8b1f9e"},{"author":{"_account_id":7763,"name":"Alexei Kornienko","email":"akornienko@mirantis.com","username":"akornienko"},"change_message_id":"bc3dfb3faca0359b40dc89c20d5b3f9a7433f386","unresolved":false,"context_lines":[{"line_number":52,"context_line":"        self.message \u003d \"Sort direction supplied was invalid.\""},{"line_number":53,"context_line":""},{"line_number":54,"context_line":""},{"line_number":55,"context_line":"class MultipleReusultFound(Exception):"},{"line_number":56,"context_line":"    pass"},{"line_number":57,"context_line":""},{"line_number":58,"context_line":""}],"source_content_type":"text/x-python","patch_set":12,"id":"AAAAQn%2F%2FyOY%3D","line":55,"updated":"2013-07-23 09:42:44.000000000","message":"s/MultipleReusultFound/MultipleResultsFound/","commit_id":"a77c526d2ffeddec1587f589ff169942d75c8bc3"},{"author":{"_account_id":7763,"name":"Alexei Kornienko","email":"akornienko@mirantis.com","username":"akornienko"},"change_message_id":"bc3dfb3faca0359b40dc89c20d5b3f9a7433f386","unresolved":false,"context_lines":[{"line_number":56,"context_line":"    pass"},{"line_number":57,"context_line":""},{"line_number":58,"context_line":""},{"line_number":59,"context_line":"class NoReusultFound(Exception):"},{"line_number":60,"context_line":"    pass"},{"line_number":61,"context_line":""},{"line_number":62,"context_line":""}],"source_content_type":"text/x-python","patch_set":12,"id":"AAAAQn%2F%2FyOQ%3D","line":59,"updated":"2013-07-23 09:42:44.000000000","message":"s/NoReusultFound/NoResultsFound/","commit_id":"a77c526d2ffeddec1587f589ff169942d75c8bc3"},{"author":{"_account_id":4491,"name":"Lianhao Lu","email":"llh_misc@outlook.com","username":"lianhao-lu"},"change_message_id":"94671ef031d8cfa26e6c6da2c3d9b75dba37acda","unresolved":false,"context_lines":[{"line_number":52,"context_line":"        self.message \u003d \"Sort direction supplied was invalid.\""},{"line_number":53,"context_line":""},{"line_number":54,"context_line":""},{"line_number":55,"context_line":"class MultipleReusultsFound(Exception):"},{"line_number":56,"context_line":"    pass"},{"line_number":57,"context_line":""},{"line_number":58,"context_line":""}],"source_content_type":"text/x-python","patch_set":13,"id":"AAAAQn%2F%2FvDg%3D","line":55,"updated":"2013-07-24 07:39:12.000000000","message":"typo. should be MultipleResultsFound","commit_id":"88970dd99080e5283166ca13259bc8ee6baa52c0"},{"author":{"_account_id":4491,"name":"Lianhao Lu","email":"llh_misc@outlook.com","username":"lianhao-lu"},"change_message_id":"94671ef031d8cfa26e6c6da2c3d9b75dba37acda","unresolved":false,"context_lines":[{"line_number":56,"context_line":"    pass"},{"line_number":57,"context_line":""},{"line_number":58,"context_line":""},{"line_number":59,"context_line":"class NoReusultsFound(Exception):"},{"line_number":60,"context_line":"    pass"},{"line_number":61,"context_line":""},{"line_number":62,"context_line":""}],"source_content_type":"text/x-python","patch_set":13,"id":"AAAAQn%2F%2FvDU%3D","line":59,"updated":"2013-07-24 07:39:12.000000000","message":"typo, should be NoResultFound","commit_id":"88970dd99080e5283166ca13259bc8ee6baa52c0"},{"author":{"_account_id":2472,"name":"Doug Hellmann","email":"dhellmann@redhat.com","username":"doug-hellmann"},"change_message_id":"4bb44f1cffc6f658a1ed5e655d28d6dc8a740507","unresolved":false,"context_lines":[{"line_number":45,"context_line":"        period_start \u003d next_start"},{"line_number":46,"context_line":""},{"line_number":47,"context_line":""},{"line_number":48,"context_line":"class InvalidSortDir(Exception):"},{"line_number":49,"context_line":""},{"line_number":50,"context_line":"    def __init__(self, sort_dir):"},{"line_number":51,"context_line":"        self.sort_dir \u003d sort_dir"}],"source_content_type":"text/x-python","patch_set":14,"id":"AAAAQn%2F%2FuAY%3D","line":48,"updated":"2013-07-24 14:41:49.000000000","message":"This could subclass from ValueError.","commit_id":"c8e98bbbef2b2f02870a65146e60d2b2abf98788"},{"author":{"_account_id":2472,"name":"Doug Hellmann","email":"dhellmann@redhat.com","username":"doug-hellmann"},"change_message_id":"4bb44f1cffc6f658a1ed5e655d28d6dc8a740507","unresolved":false,"context_lines":[{"line_number":49,"context_line":""},{"line_number":50,"context_line":"    def __init__(self, sort_dir):"},{"line_number":51,"context_line":"        self.sort_dir \u003d sort_dir"},{"line_number":52,"context_line":"        self.message \u003d \"Sort direction supplied was invalid.\""},{"line_number":53,"context_line":""},{"line_number":54,"context_line":""},{"line_number":55,"context_line":"class MultipleResultsFound(Exception):"}],"source_content_type":"text/x-python","patch_set":14,"id":"AAAAQn%2F%2FuAE%3D","line":52,"updated":"2013-07-24 14:41:49.000000000","message":"The message should be defined as a class attribute, and be wrapped with _() for translation.","commit_id":"c8e98bbbef2b2f02870a65146e60d2b2abf98788"},{"author":{"_account_id":1669,"name":"Julien Danjou","display_name":"jd","email":"julien@danjou.info","username":"jdanjou"},"change_message_id":"687221685c68a8519949622b78bbb3f673c5205e","unresolved":false,"context_lines":[{"line_number":206,"context_line":"        return: sort keys list"},{"line_number":207,"context_line":"        \"\"\""},{"line_number":208,"context_line":""},{"line_number":209,"context_line":"        sort_keys \u003d SortKeysHandler.sort_keys_extra[model_name]"},{"line_number":210,"context_line":"        if not sort_key:"},{"line_number":211,"context_line":"            return sort_keys"},{"line_number":212,"context_line":"        # NOTE(Fengqian): We need to put the sort key from user"}],"source_content_type":"text/x-python","patch_set":17,"id":"AAAAQn%2F%2FjNc%3D","line":209,"updated":"2013-07-29 12:59:23.000000000","message":"If you use the class, it\u0027s not a static method.\n\nPlus IIUC your code below will change the class attribute for all classes using this class, that sounds dubious.","commit_id":"1e7cad850eb4cbbe733bbf25212132260101b3f7"},{"author":{"_account_id":688,"name":"Sandy Walsh","email":"sandy.walsh@rackspace.com","username":"sandy-walsh"},"change_message_id":"434ed3af18ccf04b29c3c9f6e83d59b9805dccd6","unresolved":false,"context_lines":[{"line_number":45,"context_line":"        period_start \u003d next_start"},{"line_number":46,"context_line":""},{"line_number":47,"context_line":""},{"line_number":48,"context_line":"def _handle_sort_key(model_name, sort_key):"},{"line_number":49,"context_line":"    \"\"\"Generate sort keys according to the passed in sort key from user."},{"line_number":50,"context_line":""},{"line_number":51,"context_line":"    :param model_name: Database model name be query.(alarm, meter, etc.)"}],"source_content_type":"text/x-python","patch_set":20,"id":"AAAAQn%2F%2FWlU%3D","line":48,"updated":"2013-08-01 15:12:48.000000000","message":"There should be an explicit unit test for this method ... even if it\u0027s implicitly tested by the other methods.","commit_id":"d0ae6b20fb02e9767d0f613c725311c2c0cb7a26"}],"ceilometer/storage/impl_mongodb.py":[{"author":{"_account_id":2472,"name":"Doug Hellmann","email":"dhellmann@redhat.com","username":"doug-hellmann"},"change_message_id":"b35eb659e008251068d7cb824f1005a5f72f7a8a","unresolved":false,"context_lines":[{"line_number":347,"context_line":"        record \u003d copy.copy(data)"},{"line_number":348,"context_line":"        self.db.meter.insert(record)"},{"line_number":349,"context_line":""},{"line_number":350,"context_line":"    def _get_marker(self, model, marker_pairs):"},{"line_number":351,"context_line":"        \"\"\"Return the mark document according to the attribute-value pairs."},{"line_number":352,"context_line":""},{"line_number":353,"context_line":"        :param model: Database model name that be query."}],"source_content_type":"text/x-python","patch_set":7,"id":"AAAAP3%2F%2Fsg4%3D","line":350,"updated":"2013-07-12 21:06:50.000000000","message":"Why pass a name for the model instead of passing the collection?","commit_id":"1069e382608d8c7265cd2610ce008544b4340f43"},{"author":{"_account_id":2472,"name":"Doug Hellmann","email":"dhellmann@redhat.com","username":"doug-hellmann"},"change_message_id":"b35eb659e008251068d7cb824f1005a5f72f7a8a","unresolved":false,"context_lines":[{"line_number":403,"context_line":"                elif _sort_dir \u003d\u003d \u0027asc\u0027:"},{"line_number":404,"context_line":"                    sort_dir_ \u003d pymongo.ASCENDING"},{"line_number":405,"context_line":"                    flag \u003d \u0027$gt\u0027"},{"line_number":406,"context_line":"                else:"},{"line_number":407,"context_line":"                    sort_dir_ \u003d pymongo.DESCENDING"},{"line_number":408,"context_line":"                    flag \u003d \u0027$lt\u0027"},{"line_number":409,"context_line":""}],"source_content_type":"text/x-python","patch_set":7,"id":"AAAAP3%2F%2Fsh4%3D","line":406,"updated":"2013-07-12 21:06:50.000000000","message":"Raise an exception for an invalid value, so the caller knows they have passed something bad. Otherwise they may get data they don\u0027t expect as a response.","commit_id":"1069e382608d8c7265cd2610ce008544b4340f43"},{"author":{"_account_id":2472,"name":"Doug Hellmann","email":"dhellmann@redhat.com","username":"doug-hellmann"},"change_message_id":"b35eb659e008251068d7cb824f1005a5f72f7a8a","unresolved":false,"context_lines":[{"line_number":503,"context_line":"        marker \u003d None"},{"line_number":504,"context_line":"        if marker_pairs is not None:"},{"line_number":505,"context_line":"            marker \u003d self._get_marker(\u0027resource\u0027, marker_pairs\u003dmarker_pairs)"},{"line_number":506,"context_line":"            if sort_key is None:"},{"line_number":507,"context_line":"                sort_key \u003d \u0027user_id\u0027"},{"line_number":508,"context_line":"            if sort_dir is None:"},{"line_number":509,"context_line":"                sort_dir \u003d \u0027desc\u0027"}],"source_content_type":"text/x-python","patch_set":7,"id":"AAAAP3%2F%2FshM%3D","line":506,"updated":"2013-07-12 21:06:50.000000000","message":"The drivers should require the values be specified, and let the caller provide defaults. That way we only have to have the defaults set in one place, and the drivers don\u0027t have to worry about keeping the defaults consistent.","commit_id":"1069e382608d8c7265cd2610ce008544b4340f43"},{"author":{"_account_id":2472,"name":"Doug Hellmann","email":"dhellmann@redhat.com","username":"doug-hellmann"},"change_message_id":"b35eb659e008251068d7cb824f1005a5f72f7a8a","unresolved":false,"context_lines":[{"line_number":560,"context_line":"        marker \u003d None"},{"line_number":561,"context_line":"        if marker_pairs is not None:"},{"line_number":562,"context_line":"            marker \u003d self._get_marker(\u0027resource\u0027, marker_pairs\u003dmarker_pairs)"},{"line_number":563,"context_line":"            if sort_key is None:"},{"line_number":564,"context_line":"                sort_key \u003d \u0027user_id\u0027"},{"line_number":565,"context_line":"            if sort_dir is None:"},{"line_number":566,"context_line":"                sort_dir \u003d \u0027desc\u0027"}],"source_content_type":"text/x-python","patch_set":7,"id":"AAAAP3%2F%2Fsgc%3D","line":563,"updated":"2013-07-12 21:06:50.000000000","message":"See note about defaults above.","commit_id":"1069e382608d8c7265cd2610ce008544b4340f43"},{"author":{"_account_id":2472,"name":"Doug Hellmann","email":"dhellmann@redhat.com","username":"doug-hellmann"},"change_message_id":"b35eb659e008251068d7cb824f1005a5f72f7a8a","unresolved":false,"context_lines":[{"line_number":669,"context_line":"                   project\u003dNone, enabled\u003dTrue, alarm_id\u003dNone, limit\u003dNone,"},{"line_number":670,"context_line":"                   marker_pairs\u003dNone, sort_key\u003dNone, sort_dir\u003dNone):"},{"line_number":671,"context_line":"        \"\"\"Yields a lists of alarms that match filters"},{"line_number":672,"context_line":"        :param user: Optional ID for user that owns the resource."},{"line_number":673,"context_line":"        :param project: Optional ID for project that owns the resource."},{"line_number":674,"context_line":"        :param enabled: Optional boolean to list disable alarm."},{"line_number":675,"context_line":"        :param alarm_id: Optional alarm_id to return one alarm."}],"source_content_type":"text/x-python","patch_set":7,"id":"AAAAP3%2F%2FsgE%3D","line":672,"updated":"2013-07-12 21:06:50.000000000","message":"You need a blank line above the parameter list for the reST to be parsed properly.","commit_id":"1069e382608d8c7265cd2610ce008544b4340f43"},{"author":{"_account_id":1669,"name":"Julien Danjou","display_name":"jd","email":"julien@danjou.info","username":"jdanjou"},"change_message_id":"aa86b876f29277b3144228b2267e222feeec4426","unresolved":false,"context_lines":[{"line_number":45,"context_line":""},{"line_number":46,"context_line":"    def __init__(self, sort_dir):"},{"line_number":47,"context_line":"        self.sort_dir \u003d sort_dir"},{"line_number":48,"context_line":"        self.msg \u003d \"Sort direction supplied was invalid.\""},{"line_number":49,"context_line":""},{"line_number":50,"context_line":""},{"line_number":51,"context_line":"class MultipleReusultFound(Exception):"}],"source_content_type":"text/x-python","patch_set":8,"id":"AAAAP3%2F%2Fo4c%3D","line":48,"updated":"2013-07-15 14:46:22.000000000","message":"I think it\u0027s rather self.message than self.msg, no?","commit_id":"418c618d53bd62772b00b06eb447e0facc8b1f9e"},{"author":{"_account_id":1669,"name":"Julien Danjou","display_name":"jd","email":"julien@danjou.info","username":"jdanjou"},"change_message_id":"aa86b876f29277b3144228b2267e222feeec4426","unresolved":false,"context_lines":[{"line_number":362,"context_line":"        record \u003d copy.copy(data)"},{"line_number":363,"context_line":"        self.db.meter.insert(record)"},{"line_number":364,"context_line":""},{"line_number":365,"context_line":"    def _get_marker(self, db_collection, marker_pairs):"},{"line_number":366,"context_line":"        \"\"\"Return the mark document according to the attribute-value pairs."},{"line_number":367,"context_line":""},{"line_number":368,"context_line":"        :param db_collection: Database collection that be query."}],"source_content_type":"text/x-python","patch_set":8,"id":"AAAAP3%2F%2Fo4M%3D","line":365,"updated":"2013-07-15 14:46:22.000000000","message":"This seems to be a @staticmethod","commit_id":"418c618d53bd62772b00b06eb447e0facc8b1f9e"},{"author":{"_account_id":1669,"name":"Julien Danjou","display_name":"jd","email":"julien@danjou.info","username":"jdanjou"},"change_message_id":"aa86b876f29277b3144228b2267e222feeec4426","unresolved":false,"context_lines":[{"line_number":382,"context_line":"            ret \u003d db_collection.find_one(marker_pairs)"},{"line_number":383,"context_line":"        return ret"},{"line_number":384,"context_line":""},{"line_number":385,"context_line":"    def paginate_query(self, q, db_collection, limit\u003dNone, marker\u003dNone,"},{"line_number":386,"context_line":"                       sort_keys\u003dNone, sort_dir\u003dNone, sort_dirs\u003dNone):"},{"line_number":387,"context_line":"        \"\"\"Returns a query result with sorting / pagination."},{"line_number":388,"context_line":""}],"source_content_type":"text/x-python","patch_set":8,"id":"AAAAP3%2F%2Fo4A%3D","line":385,"updated":"2013-07-15 14:46:22.000000000","message":"This seems to be a @staticmethod.","commit_id":"418c618d53bd62772b00b06eb447e0facc8b1f9e"},{"author":{"_account_id":1669,"name":"Julien Danjou","display_name":"jd","email":"julien@danjou.info","username":"jdanjou"},"change_message_id":"c84244b80f1e097127cecc6dc39e276946e8a6e9","unresolved":false,"context_lines":[{"line_number":469,"context_line":"            raise MultipleReusultFound"},{"line_number":470,"context_line":"        else:"},{"line_number":471,"context_line":"            ret \u003d db_collection.find_one(marker_pairs)"},{"line_number":472,"context_line":"        return ret"},{"line_number":473,"context_line":""},{"line_number":474,"context_line":"    @staticmethod"},{"line_number":475,"context_line":"    def paginate_query(q, db_collection, limit\u003dNone, marker\u003dNone,"}],"source_content_type":"text/x-python","patch_set":10,"id":"AAAAQn%2F%2F9sY%3D","line":472,"updated":"2013-07-18 12:20:17.000000000","message":"This seems suboptimal, you\u0027re doing find() and then find_one() which may imply two requests to MongoDB.\n\nOne find() should be enough, just return the first result.","commit_id":"9a7d838971cf97a9351813fe53e9f825836d1a01"},{"author":{"_account_id":1669,"name":"Julien Danjou","display_name":"jd","email":"julien@danjou.info","username":"jdanjou"},"change_message_id":"c84244b80f1e097127cecc6dc39e276946e8a6e9","unresolved":false,"context_lines":[{"line_number":545,"context_line":"        if limit is None:"},{"line_number":546,"context_line":"            limit \u003d 0"},{"line_number":547,"context_line":""},{"line_number":548,"context_line":"        if isinstance(limit, int):"},{"line_number":549,"context_line":"            return db_collection.find(q, limit\u003dlimit, sort\u003dall_sort)"},{"line_number":550,"context_line":"        else:"},{"line_number":551,"context_line":"            raise TypeError(\"limit must be an instance of int\")"}],"source_content_type":"text/x-python","patch_set":10,"id":"AAAAQn%2F%2F9sM%3D","line":548,"updated":"2013-07-18 12:20:17.000000000","message":"I don\u0027t think you need to do this check, it\u0027s done by pymongo itself later anyway","commit_id":"9a7d838971cf97a9351813fe53e9f825836d1a01"},{"author":{"_account_id":4491,"name":"Lianhao Lu","email":"llh_misc@outlook.com","username":"lianhao-lu"},"change_message_id":"fbe45ee608236964a2920cfe0d6e376af2d159df","unresolved":false,"context_lines":[{"line_number":59,"context_line":""},{"line_number":60,"context_line":"class NoReusultFound(Exception):"},{"line_number":61,"context_line":"    pass"},{"line_number":62,"context_line":""},{"line_number":63,"context_line":""},{"line_number":64,"context_line":"class MongoDBStorage(base.StorageEngine):"},{"line_number":65,"context_line":"    \"\"\"Put the data into a MongoDB database"}],"source_content_type":"text/x-python","patch_set":11,"id":"AAAAQn%2F%2F2Lw%3D","line":62,"updated":"2013-07-22 07:51:04.000000000","message":"Just wondering if these 3 exception would be used by other backends, e.g. sqlalchemy?","commit_id":"313a79a16d2f6de6d169f32ca0dcb87d95595f90"},{"author":{"_account_id":7642,"name":"Fengqian Gao","email":"fengqian.gao@intel.com","username":"Fengqian"},"change_message_id":"60b717ab38e3cebdcca509526d43bb46f6d95732","unresolved":false,"context_lines":[{"line_number":59,"context_line":""},{"line_number":60,"context_line":"class NoReusultFound(Exception):"},{"line_number":61,"context_line":"    pass"},{"line_number":62,"context_line":""},{"line_number":63,"context_line":""},{"line_number":64,"context_line":"class MongoDBStorage(base.StorageEngine):"},{"line_number":65,"context_line":"    \"\"\"Put the data into a MongoDB database"}],"source_content_type":"text/x-python","patch_set":11,"id":"AAAAQn%2F%2F2K0%3D","line":62,"in_reply_to":"AAAAQn%2F%2F2Lw%3D","updated":"2013-07-22 14:02:05.000000000","message":"maybe not, i think. In sqlalchemy, it has its own exception while multiple results or no result found when you just query for single object. But i think it is reasonable to add these 3 exception to sqlalchemy backend","commit_id":"313a79a16d2f6de6d169f32ca0dcb87d95595f90"},{"author":{"_account_id":4491,"name":"Lianhao Lu","email":"llh_misc@outlook.com","username":"lianhao-lu"},"change_message_id":"4919a696df32f4ab4355e8d4b8c85f9b979d92ab","unresolved":false,"context_lines":[{"line_number":503,"context_line":"            for _sort_key, _sort_dir in zip(sort_keys, sort_dirs):"},{"line_number":504,"context_line":"                    if _sort_dir \u003d\u003d \u0027desc\u0027:"},{"line_number":505,"context_line":"                        sort_dir_ \u003d pymongo.DESCENDING"},{"line_number":506,"context_line":"                        flag \u003d \u0027$lt\u0027"},{"line_number":507,"context_line":"                    elif _sort_dir \u003d\u003d \u0027asc\u0027:"},{"line_number":508,"context_line":"                        sort_dir_ \u003d pymongo.ASCENDING"},{"line_number":509,"context_line":"                        flag \u003d \u0027$gt\u0027"}],"source_content_type":"text/x-python","patch_set":11,"id":"AAAAQn%2F%2F2NM%3D","line":506,"updated":"2013-07-22 07:47:00.000000000","message":"what\u0027s the use of flag here?","commit_id":"313a79a16d2f6de6d169f32ca0dcb87d95595f90"},{"author":{"_account_id":4491,"name":"Lianhao Lu","email":"llh_misc@outlook.com","username":"lianhao-lu"},"change_message_id":"4919a696df32f4ab4355e8d4b8c85f9b979d92ab","unresolved":false,"context_lines":[{"line_number":526,"context_line":"                    sort_dir_ \u003d pymongo.ASCENDING"},{"line_number":527,"context_line":"                    flag \u003d \u0027$gt\u0027"},{"line_number":528,"context_line":"                else:"},{"line_number":529,"context_line":"                    raise InvalidSortDir(sort_dir)"},{"line_number":530,"context_line":""},{"line_number":531,"context_line":"                value \u003d marker[_sort_key]"},{"line_number":532,"context_line":"                attri_instance_cmp \u003d {_sort_key: {flag: value}}"}],"source_content_type":"text/x-python","patch_set":11,"id":"AAAAQn%2F%2F2NQ%3D","line":529,"updated":"2013-07-22 07:47:00.000000000","message":"Are these duplicated with Ln504-510?","commit_id":"313a79a16d2f6de6d169f32ca0dcb87d95595f90"},{"author":{"_account_id":7763,"name":"Alexei Kornienko","email":"akornienko@mirantis.com","username":"akornienko"},"change_message_id":"bc3dfb3faca0359b40dc89c20d5b3f9a7433f386","unresolved":false,"context_lines":[{"line_number":527,"context_line":"        #NOTE(Fengqian)Now, MongoDB collection.find can not handle limit"},{"line_number":528,"context_line":"        #when it equals None, it will raise TypeError, so we treate"},{"line_number":529,"context_line":"        #None as 0 for the value of limit."},{"line_number":530,"context_line":"        if limit is None:"},{"line_number":531,"context_line":"            limit \u003d 0"},{"line_number":532,"context_line":"        return db_collection.find(q, limit\u003dlimit, sort\u003dall_sort)"},{"line_number":533,"context_line":""}],"source_content_type":"text/x-python","patch_set":12,"id":"AAAAQn%2F%2FyNs%3D","line":530,"updated":"2013-07-23 09:42:44.000000000","message":"I think it\u0027s better to set limit to some reasonable number by default (10,100)","commit_id":"a77c526d2ffeddec1587f589ff169942d75c8bc3"},{"author":{"_account_id":2813,"name":"Mehdi Abaakouk","email":"sileht@sileht.net","username":"sileht"},"change_message_id":"a411fd5c2a0ea9d69471e210be6aa28d95d93bc5","unresolved":false,"context_lines":[{"line_number":527,"context_line":"        #NOTE(Fengqian)Now, MongoDB collection.find can not handle limit"},{"line_number":528,"context_line":"        #when it equals None, it will raise TypeError, so we treate"},{"line_number":529,"context_line":"        #None as 0 for the value of limit."},{"line_number":530,"context_line":"        if limit is None:"},{"line_number":531,"context_line":"            limit \u003d 0"},{"line_number":532,"context_line":"        return db_collection.find(q, limit\u003dlimit, sort\u003dall_sort)"},{"line_number":533,"context_line":""}],"source_content_type":"text/x-python","patch_set":12,"id":"AAAAQn%2F%2Fw80%3D","line":530,"in_reply_to":"AAAAQn%2F%2FyNs%3D","updated":"2013-07-23 16:50:17.000000000","message":"limit\u003d0 is correct, We must keep the previous behavior and return all values to not break the REST api.","commit_id":"a77c526d2ffeddec1587f589ff169942d75c8bc3"},{"author":{"_account_id":4491,"name":"Lianhao Lu","email":"llh_misc@outlook.com","username":"lianhao-lu"},"change_message_id":"94671ef031d8cfa26e6c6da2c3d9b75dba37acda","unresolved":false,"context_lines":[{"line_number":460,"context_line":""},{"line_number":461,"context_line":"    @staticmethod"},{"line_number":462,"context_line":"    def paginate_query(q, db_collection, limit\u003dNone, marker\u003dNone,"},{"line_number":463,"context_line":"                       sort_keys\u003dNone, sort_dir\u003dNone, sort_dirs\u003dNone):"},{"line_number":464,"context_line":"        \"\"\"Returns a query result with sorting / pagination."},{"line_number":465,"context_line":""},{"line_number":466,"context_line":"        Pagination works by requiring sort_key and sort_dir."}],"source_content_type":"text/x-python","patch_set":13,"id":"AAAAQn%2F%2FvAY%3D","line":463,"updated":"2013-07-24 07:39:12.000000000","message":"how about set the default value to\nsort_keys\u003d[], sort_dir\u003d\u0027desc\u0027, sort_dirs\u003d[], this might make code more simple.","commit_id":"88970dd99080e5283166ca13259bc8ee6baa52c0"},{"author":{"_account_id":4491,"name":"Lianhao Lu","email":"llh_misc@outlook.com","username":"lianhao-lu"},"change_message_id":"94671ef031d8cfa26e6c6da2c3d9b75dba37acda","unresolved":false,"context_lines":[{"line_number":474,"context_line":"        :param sort_keys: array of attributes by which results be sorted."},{"line_number":475,"context_line":"        :param sort_dir: direction in which results be sorted (asc, desc)."},{"line_number":476,"context_line":"        :param sort_dirs: per-column array of sort_dirs,"},{"line_number":477,"context_line":"                          corresponding to sort_keys"},{"line_number":478,"context_line":"        return: The query with sorting/pagination added."},{"line_number":479,"context_line":"        \"\"\""},{"line_number":480,"context_line":"        if db_collection is None:"}],"source_content_type":"text/x-python","patch_set":13,"id":"AAAAQn%2F%2FvAw%3D","line":477,"updated":"2013-07-24 07:39:12.000000000","message":"Who ever will use the \u0027sort_dirs\u0027 param?","commit_id":"88970dd99080e5283166ca13259bc8ee6baa52c0"},{"author":{"_account_id":7642,"name":"Fengqian Gao","email":"fengqian.gao@intel.com","username":"Fengqian"},"change_message_id":"4d779adcf1a5040069c3fae10780f03a2c4d4a0e","unresolved":false,"context_lines":[{"line_number":474,"context_line":"        :param sort_keys: array of attributes by which results be sorted."},{"line_number":475,"context_line":"        :param sort_dir: direction in which results be sorted (asc, desc)."},{"line_number":476,"context_line":"        :param sort_dirs: per-column array of sort_dirs,"},{"line_number":477,"context_line":"                          corresponding to sort_keys"},{"line_number":478,"context_line":"        return: The query with sorting/pagination added."},{"line_number":479,"context_line":"        \"\"\""},{"line_number":480,"context_line":"        if db_collection is None:"}],"source_content_type":"text/x-python","patch_set":13,"id":"AAAAQn%2F%2Fu0g%3D","line":477,"in_reply_to":"AAAAQn%2F%2FvAw%3D","updated":"2013-07-24 10:20:15.000000000","message":"Pagination query need to identify the marker object, so it needs a unique sort_key, specified by sort_keys.\n\nWith single-valued sort_key, it just need: sort_key\u003eX;\nWith a compound-values sort_key, (K1, K2, K3), we need to do like this:\n(K1 \u003e X1) or (K1 \u003d\u003d X1 \u0026\u0026 K2 \u003e X2) or (k1 \u003d\u003d X1 \u0026\u0026 k2\u003d\u003dx2 \u0026\u0026 k3 \u003e x3).\n\nSo, it needs different sort_directions.\n\nYou can see the comments  of paginate_query function in the openstack/common/db/sqlalchemy.","commit_id":"88970dd99080e5283166ca13259bc8ee6baa52c0"},{"author":{"_account_id":4491,"name":"Lianhao Lu","email":"llh_misc@outlook.com","username":"lianhao-lu"},"change_message_id":"94671ef031d8cfa26e6c6da2c3d9b75dba37acda","unresolved":false,"context_lines":[{"line_number":489,"context_line":"        if sort_dirs is None:"},{"line_number":490,"context_line":"            sort_dirs \u003d [sort_dir for i in sort_keys]"},{"line_number":491,"context_line":""},{"line_number":492,"context_line":"        assert(len(sort_dirs) \u003d\u003d len(sort_keys))"},{"line_number":493,"context_line":"        for _sort_key, _sort_dir in zip(sort_keys, sort_dirs):"},{"line_number":494,"context_line":"            if _sort_dir \u003d\u003d \u0027desc\u0027:"},{"line_number":495,"context_line":"                all_sort_dir.append(pymongo.DESCENDING)"}],"source_content_type":"text/x-python","patch_set":13,"id":"AAAAQn%2F%2FvBk%3D","line":492,"updated":"2013-07-24 07:39:12.000000000","message":"What happens if this assertion fails?","commit_id":"88970dd99080e5283166ca13259bc8ee6baa52c0"},{"author":{"_account_id":7642,"name":"Fengqian Gao","email":"fengqian.gao@intel.com","username":"Fengqian"},"change_message_id":"4d779adcf1a5040069c3fae10780f03a2c4d4a0e","unresolved":false,"context_lines":[{"line_number":489,"context_line":"        if sort_dirs is None:"},{"line_number":490,"context_line":"            sort_dirs \u003d [sort_dir for i in sort_keys]"},{"line_number":491,"context_line":""},{"line_number":492,"context_line":"        assert(len(sort_dirs) \u003d\u003d len(sort_keys))"},{"line_number":493,"context_line":"        for _sort_key, _sort_dir in zip(sort_keys, sort_dirs):"},{"line_number":494,"context_line":"            if _sort_dir \u003d\u003d \u0027desc\u0027:"},{"line_number":495,"context_line":"                all_sort_dir.append(pymongo.DESCENDING)"}],"source_content_type":"text/x-python","patch_set":13,"id":"AAAAQn%2F%2Fu1o%3D","line":492,"in_reply_to":"AAAAQn%2F%2FvBk%3D","updated":"2013-07-24 10:20:15.000000000","message":"assert failure exception will be raised. I just want to assure that the passed in sort_keys has one sort direction for each key.","commit_id":"88970dd99080e5283166ca13259bc8ee6baa52c0"},{"author":{"_account_id":2472,"name":"Doug Hellmann","email":"dhellmann@redhat.com","username":"doug-hellmann"},"change_message_id":"4bb44f1cffc6f658a1ed5e655d28d6dc8a740507","unresolved":false,"context_lines":[{"line_number":446,"context_line":"        \"\"\""},{"line_number":447,"context_line":"        if db_collection is None:"},{"line_number":448,"context_line":"            return"},{"line_number":449,"context_line":"        if marker_pairs is None or len(marker_pairs) \u003c\u003d 0:"},{"line_number":450,"context_line":"            return"},{"line_number":451,"context_line":"        ret \u003d db_collection.find(marker_pairs)"},{"line_number":452,"context_line":""}],"source_content_type":"text/x-python","patch_set":14,"id":"AAAAQn%2F%2Ft8E%3D","line":449,"updated":"2013-07-24 14:41:49.000000000","message":"The length of a list can\u0027t be negative, so this can just be \"if not marker_pairs:\"","commit_id":"c8e98bbbef2b2f02870a65146e60d2b2abf98788"},{"author":{"_account_id":2472,"name":"Doug Hellmann","email":"dhellmann@redhat.com","username":"doug-hellmann"},"change_message_id":"4bb44f1cffc6f658a1ed5e655d28d6dc8a740507","unresolved":false,"context_lines":[{"line_number":460,"context_line":""},{"line_number":461,"context_line":"    @staticmethod"},{"line_number":462,"context_line":"    def paginate_query(q, db_collection, limit\u003dNone, marker\u003dNone,"},{"line_number":463,"context_line":"                       sort_keys\u003d[], sort_dir\u003d\u0027desc\u0027, sort_dirs\u003d[]):"},{"line_number":464,"context_line":"        \"\"\"Returns a query result with sorting / pagination."},{"line_number":465,"context_line":""},{"line_number":466,"context_line":"        Pagination works by requiring sort_key and sort_dir."}],"source_content_type":"text/x-python","patch_set":14,"id":"AAAAQn%2F%2Ft%2B0%3D","line":463,"updated":"2013-07-24 14:41:49.000000000","message":"If sort_keys and sort_dirs need to be provided as equal length lists, they should be specified as a list of tuples containing both values. If we want the web API to make the list optional, or to provide defaults, we can do that in the API code that calls into the storage layer so that the logic for handling the defaults only has to be provided once and every storage implementation can expect consistent and valid inputs (that said, I don\u0027t think we should bother with default directions).","commit_id":"c8e98bbbef2b2f02870a65146e60d2b2abf98788"},{"author":{"_account_id":7642,"name":"Fengqian Gao","email":"fengqian.gao@intel.com","username":"Fengqian"},"change_message_id":"87b6cde69d15dee1bb68824e0b9352b9bd1c3c2d","unresolved":false,"context_lines":[{"line_number":460,"context_line":""},{"line_number":461,"context_line":"    @staticmethod"},{"line_number":462,"context_line":"    def paginate_query(q, db_collection, limit\u003dNone, marker\u003dNone,"},{"line_number":463,"context_line":"                       sort_keys\u003d[], sort_dir\u003d\u0027desc\u0027, sort_dirs\u003d[]):"},{"line_number":464,"context_line":"        \"\"\"Returns a query result with sorting / pagination."},{"line_number":465,"context_line":""},{"line_number":466,"context_line":"        Pagination works by requiring sort_key and sort_dir."}],"source_content_type":"text/x-python","patch_set":14,"id":"AAAAQn%2F%2Frgs%3D","line":463,"in_reply_to":"AAAAQn%2F%2Ft%2B0%3D","updated":"2013-07-26 02:36:14.000000000","message":"i will remove sort_dirs here, just use sort_dir. At the same time , each sort_key will sort in the same direction. \n I think for most of users, it will be easy to just provide just one sort_key and sort_dir pairs.  That what we are doing now. \nOn the other side, i want to keep in line with the sqlalchemy paginate_query() function of openstack/common/db/sqlalchemy/utils.py, which has been used in cinder, glance module.","commit_id":"c8e98bbbef2b2f02870a65146e60d2b2abf98788"},{"author":{"_account_id":2472,"name":"Doug Hellmann","email":"dhellmann@redhat.com","username":"doug-hellmann"},"change_message_id":"4bb44f1cffc6f658a1ed5e655d28d6dc8a740507","unresolved":false,"context_lines":[{"line_number":491,"context_line":"        assert(len(sort_dirs) \u003d\u003d len(sort_keys))"},{"line_number":492,"context_line":"        for _sort_key, _sort_dir in zip(sort_keys, sort_dirs):"},{"line_number":493,"context_line":"            if _sort_dir \u003d\u003d \u0027desc\u0027:"},{"line_number":494,"context_line":"                all_sort_dir.append(pymongo.DESCENDING)"},{"line_number":495,"context_line":"                all_sort_flag.append(\u0027$lt\u0027)"},{"line_number":496,"context_line":"            elif _sort_dir \u003d\u003d \u0027asc\u0027:"},{"line_number":497,"context_line":"                all_sort_dir.append(pymongo.ASCENDING)"}],"source_content_type":"text/x-python","patch_set":14,"id":"AAAAQn%2F%2Ft%2BA%3D","line":494,"updated":"2013-07-24 14:41:49.000000000","message":"I see these various lists getting zipped together when they are actually used, which makes me think they could be a single list in the first place.","commit_id":"c8e98bbbef2b2f02870a65146e60d2b2abf98788"},{"author":{"_account_id":2472,"name":"Doug Hellmann","email":"dhellmann@redhat.com","username":"doug-hellmann"},"change_message_id":"4bb44f1cffc6f658a1ed5e655d28d6dc8a740507","unresolved":false,"context_lines":[{"line_number":505,"context_line":"                    all_sort.append(_all_sort)"},{"line_number":506,"context_line":""},{"line_number":507,"context_line":"        if marker is not None:"},{"line_number":508,"context_line":"            attri_list \u003d []"},{"line_number":509,"context_line":"            attri_instance_equ \u003d {}"},{"line_number":510,"context_line":"            attri_instance_cmp \u003d {}"},{"line_number":511,"context_line":""}],"source_content_type":"text/x-python","patch_set":14,"id":"AAAAQn%2F%2Ft84%3D","line":508,"updated":"2013-07-24 14:41:49.000000000","message":"What does the abbreviation \"attri\" mean?","commit_id":"c8e98bbbef2b2f02870a65146e60d2b2abf98788"},{"author":{"_account_id":7642,"name":"Fengqian Gao","email":"fengqian.gao@intel.com","username":"Fengqian"},"change_message_id":"87b6cde69d15dee1bb68824e0b9352b9bd1c3c2d","unresolved":false,"context_lines":[{"line_number":505,"context_line":"                    all_sort.append(_all_sort)"},{"line_number":506,"context_line":""},{"line_number":507,"context_line":"        if marker is not None:"},{"line_number":508,"context_line":"            attri_list \u003d []"},{"line_number":509,"context_line":"            attri_instance_equ \u003d {}"},{"line_number":510,"context_line":"            attri_instance_cmp \u003d {}"},{"line_number":511,"context_line":""}],"source_content_type":"text/x-python","patch_set":14,"id":"AAAAQn%2F%2Fr10%3D","line":508,"in_reply_to":"AAAAQn%2F%2Ft84%3D","updated":"2013-07-26 02:36:14.000000000","message":"it means \"attribute\" here. It seems not quite appropriate here. I will change it to \"sort_criteria\"","commit_id":"c8e98bbbef2b2f02870a65146e60d2b2abf98788"},{"author":{"_account_id":2472,"name":"Doug Hellmann","email":"dhellmann@redhat.com","username":"doug-hellmann"},"change_message_id":"4bb44f1cffc6f658a1ed5e655d28d6dc8a740507","unresolved":false,"context_lines":[{"line_number":513,"context_line":"                value \u003d marker[_sort_key]"},{"line_number":514,"context_line":"                attri_instance_cmp \u003d {_sort_key: {flag: value}}"},{"line_number":515,"context_line":""},{"line_number":516,"context_line":"                for i in xrange(0, len(attri_list)):"},{"line_number":517,"context_line":"                    attri_instance_equ[sort_keys[i]] \u003d marker[sort_keys[i]]"},{"line_number":518,"context_line":""},{"line_number":519,"context_line":"                attri_instance \u003d dict(attri_instance_equ.items() +"}],"source_content_type":"text/x-python","patch_set":14,"id":"AAAAQn%2F%2Ft9c%3D","line":516,"updated":"2013-07-24 14:41:49.000000000","message":"This loop is iterating over the length of one list and using the values to index into another. Why not just iterate over the interesting list in the first place?\n\n  for k in sort_keys:\n    attri_instance_equ[k] \u003d marker[k]","commit_id":"c8e98bbbef2b2f02870a65146e60d2b2abf98788"},{"author":{"_account_id":2472,"name":"Doug Hellmann","email":"dhellmann@redhat.com","username":"doug-hellmann"},"change_message_id":"ecf039925289ad1761b74270f7fe47a3021ebeee","unresolved":false,"context_lines":[{"line_number":513,"context_line":"                value \u003d marker[_sort_key]"},{"line_number":514,"context_line":"                attri_instance_cmp \u003d {_sort_key: {flag: value}}"},{"line_number":515,"context_line":""},{"line_number":516,"context_line":"                for i in xrange(0, len(attri_list)):"},{"line_number":517,"context_line":"                    attri_instance_equ[sort_keys[i]] \u003d marker[sort_keys[i]]"},{"line_number":518,"context_line":""},{"line_number":519,"context_line":"                attri_instance \u003d dict(attri_instance_equ.items() +"}],"source_content_type":"text/x-python","patch_set":14,"id":"AAAAQn%2F%2FnwU%3D","line":516,"in_reply_to":"AAAAQn%2F%2Fr2Y%3D","updated":"2013-07-26 11:09:24.000000000","message":"OK. The original loop doesn\u0027t handle those cases either.","commit_id":"c8e98bbbef2b2f02870a65146e60d2b2abf98788"},{"author":{"_account_id":7642,"name":"Fengqian Gao","email":"fengqian.gao@intel.com","username":"Fengqian"},"change_message_id":"87b6cde69d15dee1bb68824e0b9352b9bd1c3c2d","unresolved":false,"context_lines":[{"line_number":513,"context_line":"                value \u003d marker[_sort_key]"},{"line_number":514,"context_line":"                attri_instance_cmp \u003d {_sort_key: {flag: value}}"},{"line_number":515,"context_line":""},{"line_number":516,"context_line":"                for i in xrange(0, len(attri_list)):"},{"line_number":517,"context_line":"                    attri_instance_equ[sort_keys[i]] \u003d marker[sort_keys[i]]"},{"line_number":518,"context_line":""},{"line_number":519,"context_line":"                attri_instance \u003d dict(attri_instance_equ.items() +"}],"source_content_type":"text/x-python","patch_set":14,"id":"AAAAQn%2F%2Fr2Y%3D","line":516,"in_reply_to":"AAAAQn%2F%2Ft9c%3D","updated":"2013-07-26 02:36:14.000000000","message":"Actually, i need to handle multiple sort keys here, For example sort_keys\u003d(k1, k2, k3), so the metaquery should be (k1 \u003e X1) or (k1 \u003d\u003d X1 \u0026\u0026 k2 \u003e X2) or (k1 \u003d\u003d X1 \u0026\u0026 k2 \u003d\u003d X2 \u0026\u0026 k3 \u003e X3). The three list, k1\u003ex1, k1\u003d\u003dx1\u0026\u0026 k2\u003ex2, k1 \u003d\u003d X1 \u0026\u0026 k2 \u003d\u003d X2 \u0026\u0026 k3 \u003e X3 should be generated in the iteration.\n\nI think these codes may not help.\n\nfor k in sort_keys:\n   attri_instance_equ[k] \u003d marker[k]","commit_id":"c8e98bbbef2b2f02870a65146e60d2b2abf98788"},{"author":{"_account_id":2472,"name":"Doug Hellmann","email":"dhellmann@redhat.com","username":"doug-hellmann"},"change_message_id":"4bb44f1cffc6f658a1ed5e655d28d6dc8a740507","unresolved":false,"context_lines":[{"line_number":604,"context_line":"        # easily testable yet. Since it was bugged before anyway, it\u0027s still"},{"line_number":605,"context_line":"        # better for now."},{"line_number":606,"context_line":"        marker \u003d None"},{"line_number":607,"context_line":"        if marker_pairs is not None:"},{"line_number":608,"context_line":"            marker \u003d self._get_marker(self.db.resource,"},{"line_number":609,"context_line":"                                      marker_pairs\u003dmarker_pairs)"},{"line_number":610,"context_line":"        sort_keys \u003d [\u0027user_id\u0027, \u0027project_id\u0027]"}],"source_content_type":"text/x-python","patch_set":14,"id":"AAAAQn%2F%2Ft74%3D","line":607,"updated":"2013-07-24 14:41:49.000000000","message":"This test is redundant, because the method performs the same test.","commit_id":"c8e98bbbef2b2f02870a65146e60d2b2abf98788"},{"author":{"_account_id":2472,"name":"Doug Hellmann","email":"dhellmann@redhat.com","username":"doug-hellmann"},"change_message_id":"4bb44f1cffc6f658a1ed5e655d28d6dc8a740507","unresolved":false,"context_lines":[{"line_number":607,"context_line":"        if marker_pairs is not None:"},{"line_number":608,"context_line":"            marker \u003d self._get_marker(self.db.resource,"},{"line_number":609,"context_line":"                                      marker_pairs\u003dmarker_pairs)"},{"line_number":610,"context_line":"        sort_keys \u003d [\u0027user_id\u0027, \u0027project_id\u0027]"},{"line_number":611,"context_line":"        if sort_key is not None:"},{"line_number":612,"context_line":"            sort_keys.insert(0, sort_key)"},{"line_number":613,"context_line":""}],"source_content_type":"text/x-python","patch_set":14,"id":"AAAAQn%2F%2Ft8c%3D","line":610,"updated":"2013-07-24 14:41:49.000000000","message":"Why are user_id and project_id required as part of the sort key?","commit_id":"c8e98bbbef2b2f02870a65146e60d2b2abf98788"},{"author":{"_account_id":2472,"name":"Doug Hellmann","email":"dhellmann@redhat.com","username":"doug-hellmann"},"change_message_id":"ecf039925289ad1761b74270f7fe47a3021ebeee","unresolved":false,"context_lines":[{"line_number":607,"context_line":"        if marker_pairs is not None:"},{"line_number":608,"context_line":"            marker \u003d self._get_marker(self.db.resource,"},{"line_number":609,"context_line":"                                      marker_pairs\u003dmarker_pairs)"},{"line_number":610,"context_line":"        sort_keys \u003d [\u0027user_id\u0027, \u0027project_id\u0027]"},{"line_number":611,"context_line":"        if sort_key is not None:"},{"line_number":612,"context_line":"            sort_keys.insert(0, sort_key)"},{"line_number":613,"context_line":""}],"source_content_type":"text/x-python","patch_set":14,"id":"AAAAQn%2F%2FnwI%3D","line":610,"in_reply_to":"AAAAQn%2F%2Frj4%3D","updated":"2013-07-26 11:09:24.000000000","message":"Those sorts of defaults should be handled at the higher level so all of the database drivers don\u0027t have to worry about them.\n\nThat said, I don\u0027t think the defaults should be provided unless it is technically necessary to produce correct results. Some callers won\u0027t care about the user id, for example, so why force sorting on that value?","commit_id":"c8e98bbbef2b2f02870a65146e60d2b2abf98788"},{"author":{"_account_id":7642,"name":"Fengqian Gao","email":"fengqian.gao@intel.com","username":"Fengqian"},"change_message_id":"87b6cde69d15dee1bb68824e0b9352b9bd1c3c2d","unresolved":false,"context_lines":[{"line_number":607,"context_line":"        if marker_pairs is not None:"},{"line_number":608,"context_line":"            marker \u003d self._get_marker(self.db.resource,"},{"line_number":609,"context_line":"                                      marker_pairs\u003dmarker_pairs)"},{"line_number":610,"context_line":"        sort_keys \u003d [\u0027user_id\u0027, \u0027project_id\u0027]"},{"line_number":611,"context_line":"        if sort_key is not None:"},{"line_number":612,"context_line":"            sort_keys.insert(0, sort_key)"},{"line_number":613,"context_line":""}],"source_content_type":"text/x-python","patch_set":14,"id":"AAAAQn%2F%2Frj4%3D","line":610,"in_reply_to":"AAAAQn%2F%2Ft8c%3D","updated":"2013-07-26 02:36:14.000000000","message":"Because sort_key passed from API level is single one.  It could be a problem during the sorting process because some objects may have the same value for this single key. So, we need more keys for sorting. But for users, they may not want to pass in all those keys one by one. Then we provide some extra keys here.","commit_id":"c8e98bbbef2b2f02870a65146e60d2b2abf98788"},{"author":{"_account_id":2472,"name":"Doug Hellmann","email":"dhellmann@redhat.com","username":"doug-hellmann"},"change_message_id":"4bb44f1cffc6f658a1ed5e655d28d6dc8a740507","unresolved":false,"context_lines":[{"line_number":660,"context_line":"        q.update(metaquery)"},{"line_number":661,"context_line":""},{"line_number":662,"context_line":"        marker \u003d None"},{"line_number":663,"context_line":"        if marker_pairs is not None:"},{"line_number":664,"context_line":"            marker \u003d self._get_marker(self.db.resource,"},{"line_number":665,"context_line":"                                      marker_pairs\u003dmarker_pairs)"},{"line_number":666,"context_line":"        sort_keys \u003d [\u0027user_id\u0027, \u0027project_id\u0027]"}],"source_content_type":"text/x-python","patch_set":14,"id":"AAAAQn%2F%2Ft7w%3D","line":663,"updated":"2013-07-24 14:41:49.000000000","message":"This test is redundant, because the method performs the same test.","commit_id":"c8e98bbbef2b2f02870a65146e60d2b2abf98788"},{"author":{"_account_id":2472,"name":"Doug Hellmann","email":"dhellmann@redhat.com","username":"doug-hellmann"},"change_message_id":"4bb44f1cffc6f658a1ed5e655d28d6dc8a740507","unresolved":false,"context_lines":[{"line_number":663,"context_line":"        if marker_pairs is not None:"},{"line_number":664,"context_line":"            marker \u003d self._get_marker(self.db.resource,"},{"line_number":665,"context_line":"                                      marker_pairs\u003dmarker_pairs)"},{"line_number":666,"context_line":"        sort_keys \u003d [\u0027user_id\u0027, \u0027project_id\u0027]"},{"line_number":667,"context_line":"        if sort_key is not None:"},{"line_number":668,"context_line":"            sort_keys.insert(0, sort_key)"},{"line_number":669,"context_line":""}],"source_content_type":"text/x-python","patch_set":14,"id":"AAAAQn%2F%2Ft7k%3D","line":666,"updated":"2013-07-24 14:41:49.000000000","message":"These same constants appear in the method above. If they are always required, they should go in a class attribute.","commit_id":"c8e98bbbef2b2f02870a65146e60d2b2abf98788"},{"author":{"_account_id":2472,"name":"Doug Hellmann","email":"dhellmann@redhat.com","username":"doug-hellmann"},"change_message_id":"4bb44f1cffc6f658a1ed5e655d28d6dc8a740507","unresolved":false,"context_lines":[{"line_number":789,"context_line":"            q[\u0027alarm_id\u0027] \u003d alarm_id"},{"line_number":790,"context_line":""},{"line_number":791,"context_line":"        marker \u003d None"},{"line_number":792,"context_line":"        if marker_pairs is not None:"},{"line_number":793,"context_line":"            marker \u003d self._get_marker(self.db.alarm, marker_pairs\u003dmarker_pairs)"},{"line_number":794,"context_line":"        sort_keys \u003d [\u0027name\u0027, \u0027user_id\u0027, \u0027project_id\u0027]"},{"line_number":795,"context_line":"        if sort_key is not None:"}],"source_content_type":"text/x-python","patch_set":14,"id":"AAAAQn%2F%2Ft7Q%3D","line":792,"updated":"2013-07-24 14:41:49.000000000","message":"Redundant check.","commit_id":"c8e98bbbef2b2f02870a65146e60d2b2abf98788"},{"author":{"_account_id":2472,"name":"Doug Hellmann","email":"dhellmann@redhat.com","username":"doug-hellmann"},"change_message_id":"4bb44f1cffc6f658a1ed5e655d28d6dc8a740507","unresolved":false,"context_lines":[{"line_number":791,"context_line":"        marker \u003d None"},{"line_number":792,"context_line":"        if marker_pairs is not None:"},{"line_number":793,"context_line":"            marker \u003d self._get_marker(self.db.alarm, marker_pairs\u003dmarker_pairs)"},{"line_number":794,"context_line":"        sort_keys \u003d [\u0027name\u0027, \u0027user_id\u0027, \u0027project_id\u0027]"},{"line_number":795,"context_line":"        if sort_key is not None:"},{"line_number":796,"context_line":"            sort_keys.insert(0, sort_key)"},{"line_number":797,"context_line":""}],"source_content_type":"text/x-python","patch_set":14,"id":"AAAAQn%2F%2Ft7E%3D","line":794,"updated":"2013-07-24 14:41:49.000000000","message":"These default sort keys are different from the others. Why?","commit_id":"c8e98bbbef2b2f02870a65146e60d2b2abf98788"},{"author":{"_account_id":7642,"name":"Fengqian Gao","email":"fengqian.gao@intel.com","username":"Fengqian"},"change_message_id":"87b6cde69d15dee1bb68824e0b9352b9bd1c3c2d","unresolved":false,"context_lines":[{"line_number":791,"context_line":"        marker \u003d None"},{"line_number":792,"context_line":"        if marker_pairs is not None:"},{"line_number":793,"context_line":"            marker \u003d self._get_marker(self.db.alarm, marker_pairs\u003dmarker_pairs)"},{"line_number":794,"context_line":"        sort_keys \u003d [\u0027name\u0027, \u0027user_id\u0027, \u0027project_id\u0027]"},{"line_number":795,"context_line":"        if sort_key is not None:"},{"line_number":796,"context_line":"            sort_keys.insert(0, sort_key)"},{"line_number":797,"context_line":""}],"source_content_type":"text/x-python","patch_set":14,"id":"AAAAQn%2F%2Frng%3D","line":794,"in_reply_to":"AAAAQn%2F%2Ft7E%3D","updated":"2013-07-26 02:36:14.000000000","message":"Because each collection, alarm, meter, resource, has different keys","commit_id":"c8e98bbbef2b2f02870a65146e60d2b2abf98788"},{"author":{"_account_id":2813,"name":"Mehdi Abaakouk","email":"sileht@sileht.net","username":"sileht"},"change_message_id":"e0a1d943c466338eafdf7c6de1814136e664647a","unresolved":false,"context_lines":[{"line_number":434,"context_line":"            return"},{"line_number":435,"context_line":"        if not marker_pairs:"},{"line_number":436,"context_line":"            return"},{"line_number":437,"context_line":"        ret \u003d db_collection.find(marker_pairs)"},{"line_number":438,"context_line":""},{"line_number":439,"context_line":"        if ret is None:"},{"line_number":440,"context_line":"            raise base.NoResultFound"}],"source_content_type":"text/x-python","patch_set":16,"id":"AAAAQn%2F%2Fn30%3D","line":437,"updated":"2013-07-26 09:48:37.000000000","message":"We can add limit\u003d2 to limit the database load.","commit_id":"cc849c36c07c64fbea991914fb3e66ad13c29fe2"},{"author":{"_account_id":2813,"name":"Mehdi Abaakouk","email":"sileht@sileht.net","username":"sileht"},"change_message_id":"e0a1d943c466338eafdf7c6de1814136e664647a","unresolved":false,"context_lines":[{"line_number":477,"context_line":"            _sort_dir \u003d pymongo.ASCENDING"},{"line_number":478,"context_line":"            _sort_flag \u003d \u0027$gt\u0027"},{"line_number":479,"context_line":"        else:"},{"line_number":480,"context_line":"            raise base.InvalidSortDir(_sort_dir)"},{"line_number":481,"context_line":""},{"line_number":482,"context_line":"        if sort_keys:"},{"line_number":483,"context_line":"            for _sort_key in sort_keys:"}],"source_content_type":"text/x-python","patch_set":16,"id":"AAAAQn%2F%2FoAQ%3D","line":480,"updated":"2013-07-26 09:48:37.000000000","message":"Not sure that the storage backend should verify if the sort field is correct.\nThe API parts of BD pagination already do this check. \n\nAnd if we remove the raise we can easily write, shorter version of this code:\n\nsort_mapping \u003d { \u0027desc\u0027: (pymongo.DESCENDING, \u0027$lt\u0027),\n                 \u0027asc\u0027: (pymongo.ASCENDING, \u0027$gt\u0027)}\n\n_sort_dir, _sort_flag \u003d sort_mapping.get(sort_dir, sort_mapping[\u0027desc\u0027])","commit_id":"cc849c36c07c64fbea991914fb3e66ad13c29fe2"},{"author":{"_account_id":2813,"name":"Mehdi Abaakouk","email":"sileht@sileht.net","username":"sileht"},"change_message_id":"e0a1d943c466338eafdf7c6de1814136e664647a","unresolved":false,"context_lines":[{"line_number":480,"context_line":"            raise base.InvalidSortDir(_sort_dir)"},{"line_number":481,"context_line":""},{"line_number":482,"context_line":"        if sort_keys:"},{"line_number":483,"context_line":"            for _sort_key in sort_keys:"},{"line_number":484,"context_line":"                _all_sort \u003d (_sort_key, _sort_dir)"},{"line_number":485,"context_line":"                all_sort.append(_all_sort)"},{"line_number":486,"context_line":""}],"source_content_type":"text/x-python","patch_set":16,"id":"AAAAQn%2F%2FoA8%3D","line":483,"updated":"2013-07-26 09:48:37.000000000","message":"The type of sort_keys is a array, so it is not useful the check if the array is empty, \u0027for i in\u0027 don\u0027t iterate on empty array.","commit_id":"cc849c36c07c64fbea991914fb3e66ad13c29fe2"},{"author":{"_account_id":2813,"name":"Mehdi Abaakouk","email":"sileht@sileht.net","username":"sileht"},"change_message_id":"e0a1d943c466338eafdf7c6de1814136e664647a","unresolved":false,"context_lines":[{"line_number":485,"context_line":"                all_sort.append(_all_sort)"},{"line_number":486,"context_line":""},{"line_number":487,"context_line":"        if marker is not None:"},{"line_number":488,"context_line":"            sort_ceriteria_list \u003d []"},{"line_number":489,"context_line":""},{"line_number":490,"context_line":"            for _sort_key in sort_keys:"},{"line_number":491,"context_line":"                ceriteria_instance_equ \u003d {}"}],"source_content_type":"text/x-python","patch_set":16,"id":"AAAAQn%2F%2Fn%2BY%3D","line":488,"updated":"2013-07-26 09:48:37.000000000","message":"s/ceriteria/criteria/g","commit_id":"cc849c36c07c64fbea991914fb3e66ad13c29fe2"},{"author":{"_account_id":2813,"name":"Mehdi Abaakouk","email":"sileht@sileht.net","username":"sileht"},"change_message_id":"e0a1d943c466338eafdf7c6de1814136e664647a","unresolved":false,"context_lines":[{"line_number":499,"context_line":"                sort_ceriteria_instance \u003d dict(ceriteria_instance_equ,"},{"line_number":500,"context_line":"                                               **ceriteria_instance_cmp)"},{"line_number":501,"context_line":"                sort_ceriteria_list.append(sort_ceriteria_instance)"},{"line_number":502,"context_line":""},{"line_number":503,"context_line":"            metaquery \u003d {\"$or\": sort_ceriteria_list}"},{"line_number":504,"context_line":"            q.update(metaquery)"},{"line_number":505,"context_line":""}],"source_content_type":"text/x-python","patch_set":16,"id":"AAAAQn%2F%2Fn5c%3D","line":502,"updated":"2013-07-26 09:48:37.000000000","message":"(just thinking) Very hard to see how the result request look. \u0027sort_ceriteria_list\u0027 seems to be used recursively, perhaps it can be more readable with a recursive method to split the algorithm, what do you think ?.","commit_id":"cc849c36c07c64fbea991914fb3e66ad13c29fe2"},{"author":{"_account_id":2813,"name":"Mehdi Abaakouk","email":"sileht@sileht.net","username":"sileht"},"change_message_id":"e0a1d943c466338eafdf7c6de1814136e664647a","unresolved":false,"context_lines":[{"line_number":588,"context_line":"        # FIXME(jd): We should use self.db.meter.group() and not use the"},{"line_number":589,"context_line":"        # resource collection, but that\u0027s not supported by MIM, so it\u0027s not"},{"line_number":590,"context_line":"        # easily testable yet. Since it was bugged before anyway, it\u0027s still"},{"line_number":591,"context_line":"        # better for now."},{"line_number":592,"context_line":"        marker \u003d self._get_marker(self.db.resource, marker_pairs\u003dmarker_pairs)"},{"line_number":593,"context_line":"        sort_keys \u003d self._handle_sort_key(\u0027resource\u0027, sort_key)"},{"line_number":594,"context_line":""}],"source_content_type":"text/x-python","patch_set":16,"id":"AAAAQn%2F%2FoBI%3D","line":591,"updated":"2013-07-26 09:48:37.000000000","message":"The comment is no more at the right place","commit_id":"cc849c36c07c64fbea991914fb3e66ad13c29fe2"},{"author":{"_account_id":2813,"name":"Mehdi Abaakouk","email":"sileht@sileht.net","username":"sileht"},"change_message_id":"e0a1d943c466338eafdf7c6de1814136e664647a","unresolved":false,"context_lines":[{"line_number":741,"context_line":"                   project\u003dNone, enabled\u003dTrue, alarm_id\u003dNone, limit\u003dNone,"},{"line_number":742,"context_line":"                   marker_pairs\u003dNone, sort_key\u003dNone, sort_dir\u003dNone):"},{"line_number":743,"context_line":"        \"\"\"Yields a lists of alarms that match filters"},{"line_number":744,"context_line":""},{"line_number":745,"context_line":"        :param user: Optional ID for user that owns the resource."},{"line_number":746,"context_line":"        :param project: Optional ID for project that owns the resource."},{"line_number":747,"context_line":"        :param enabled: Optional boolean to list disable alarm."}],"source_content_type":"text/x-python","patch_set":16,"id":"AAAAQn%2F%2Fn6k%3D","line":744,"updated":"2013-07-26 09:48:37.000000000","message":"param \u0027name\u0027 is missing in the docstring","commit_id":"cc849c36c07c64fbea991914fb3e66ad13c29fe2"},{"author":{"_account_id":1669,"name":"Julien Danjou","display_name":"jd","email":"julien@danjou.info","username":"jdanjou"},"change_message_id":"687221685c68a8519949622b78bbb3f673c5205e","unresolved":false,"context_lines":[{"line_number":435,"context_line":"        :param sort_dir: direction in which results be sorted (asc, desc)."},{"line_number":436,"context_line":"        return: The query with sorting/pagination added."},{"line_number":437,"context_line":"        \"\"\""},{"line_number":438,"context_line":"        def _recurse_sort_keys(sort_keys, marker, flag):"},{"line_number":439,"context_line":"            _first \u003d sort_keys[0]"},{"line_number":440,"context_line":"            value \u003d marker[_first]"},{"line_number":441,"context_line":"            if len(sort_keys) \u003d\u003d 1:"}],"source_content_type":"text/x-python","patch_set":17,"id":"AAAAQn%2F%2FjLc%3D","line":438,"updated":"2013-07-29 12:59:23.000000000","message":"This doesn\u0027t include any local variable and is not a closure, so it should be defined as a static method","commit_id":"1e7cad850eb4cbbe733bbf25212132260101b3f7"},{"author":{"_account_id":1669,"name":"Julien Danjou","display_name":"jd","email":"julien@danjou.info","username":"jdanjou"},"change_message_id":"d929de2e5d88d685ddccf9489792e7f7bf44ba20","unresolved":false,"context_lines":[{"line_number":425,"context_line":"        else:"},{"line_number":426,"context_line":"            criteria_equ \u003d {_first: {\u0027eq\u0027: value}}"},{"line_number":427,"context_line":"            criteria_cmp \u003d Connection._recurse_sort_keys(sort_keys[1:],"},{"line_number":428,"context_line":"                                                         marker, flag)"},{"line_number":429,"context_line":"        return dict(criteria_equ, ** criteria_cmp)"},{"line_number":430,"context_line":""},{"line_number":431,"context_line":"    @staticmethod"}],"source_content_type":"text/x-python","patch_set":19,"id":"AAAAQn%2F%2Fapw%3D","line":428,"updated":"2013-07-31 14:56:02.000000000","message":"If you need Connection, then this should be a @classmethod","commit_id":"350da55fac52999bd38ad51f71ab0eff6eb0bedf"},{"author":{"_account_id":1669,"name":"Julien Danjou","display_name":"jd","email":"julien@danjou.info","username":"jdanjou"},"change_message_id":"d929de2e5d88d685ddccf9489792e7f7bf44ba20","unresolved":false,"context_lines":[{"line_number":463,"context_line":"            sort_criteria_list \u003d []"},{"line_number":464,"context_line":""},{"line_number":465,"context_line":"            for i in range(0, len(sort_keys)):"},{"line_number":466,"context_line":"                sort_criteria_list.append(Connection._recurse_sort_keys("},{"line_number":467,"context_line":"                                          sort_keys[:(len(sort_keys) - i)],"},{"line_number":468,"context_line":"                                          marker, _sort_flag))"},{"line_number":469,"context_line":""}],"source_content_type":"text/x-python","patch_set":19,"id":"AAAAQn%2F%2Fapk%3D","line":466,"updated":"2013-07-31 14:56:02.000000000","message":"Don\u0027t hardcode Connection here neither. Use a @classmethod rather than @staticmethod.","commit_id":"350da55fac52999bd38ad51f71ab0eff6eb0bedf"},{"author":{"_account_id":688,"name":"Sandy Walsh","email":"sandy.walsh@rackspace.com","username":"sandy-walsh"},"change_message_id":"434ed3af18ccf04b29c3c9f6e83d59b9805dccd6","unresolved":false,"context_lines":[{"line_number":396,"context_line":"        self.db.resource.remove({\u0027_id\u0027: {\u0027$nin\u0027: results[\u0027resources\u0027]}})"},{"line_number":397,"context_line":""},{"line_number":398,"context_line":"    @staticmethod"},{"line_number":399,"context_line":"    def _get_marker(db_collection, marker_pairs):"},{"line_number":400,"context_line":"        \"\"\"Return the mark document according to the attribute-value pairs."},{"line_number":401,"context_line":""},{"line_number":402,"context_line":"        :param db_collection: Database collection that be query."}],"source_content_type":"text/x-python","patch_set":20,"id":"AAAAQn%2F%2FWks%3D","line":399,"updated":"2013-08-01 15:12:48.000000000","message":"Same here. Should have an explicit unit test to cover all code branches.","commit_id":"d0ae6b20fb02e9767d0f613c725311c2c0cb7a26"},{"author":{"_account_id":688,"name":"Sandy Walsh","email":"sandy.walsh@rackspace.com","username":"sandy-walsh"},"change_message_id":"434ed3af18ccf04b29c3c9f6e83d59b9805dccd6","unresolved":false,"context_lines":[{"line_number":417,"context_line":"            return _ret"},{"line_number":418,"context_line":""},{"line_number":419,"context_line":"    @classmethod"},{"line_number":420,"context_line":"    def _recurse_sort_keys(cls, sort_keys, marker, flag):"},{"line_number":421,"context_line":"        _first \u003d sort_keys[0]"},{"line_number":422,"context_line":"        value \u003d marker[_first]"},{"line_number":423,"context_line":"        if len(sort_keys) \u003d\u003d 1:"}],"source_content_type":"text/x-python","patch_set":20,"id":"AAAAQn%2F%2FWkc%3D","line":420,"updated":"2013-08-01 15:12:48.000000000","message":"needs explicit test.","commit_id":"d0ae6b20fb02e9767d0f613c725311c2c0cb7a26"}],"tests/storage/test_impl_mongodb.py":[{"author":{"_account_id":1669,"name":"Julien Danjou","display_name":"jd","email":"julien@danjou.info","username":"jdanjou"},"change_message_id":"687221685c68a8519949622b78bbb3f673c5205e","unresolved":false,"context_lines":[{"line_number":133,"context_line":"    pass"},{"line_number":134,"context_line":""},{"line_number":135,"context_line":""},{"line_number":136,"context_line":"class MeterTestpagination(base.MeterTestPagination, MongoDBEngineTestBase):"},{"line_number":137,"context_line":"    pass"},{"line_number":138,"context_line":""},{"line_number":139,"context_line":""}],"source_content_type":"text/x-python","patch_set":17,"id":"AAAAQn%2F%2FjK8%3D","line":136,"updated":"2013-07-29 12:59:23.000000000","message":"Pagination with a P not p :)","commit_id":"1e7cad850eb4cbbe733bbf25212132260101b3f7"}]}
