From b313111250e38d6b80248f2772ae226b8022cb88 Mon Sep 17 00:00:00 2001 From: Ethan Glasser-Camp Date: Fri, 4 May 2018 16:09:53 -0400 Subject: [PATCH] Don't use ID as a unique key for any given query Because parent_id with wildcards can match different objects that have the same ID, this old use of records indexed by IDs to get the union of a bunch of records no longer works. Instead, rely on the fact that the same record, matched multiple times, is the same object in memory, and use its memory location as its unique ID. This is kind of a hack, but I couldn't think of a better solution. Although this is one obvious place where we rely on every object in a given "result set" having a unique ID, there may be others hidden elsewhere. Refs: #1616 --- kinto/core/storage/memory.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/kinto/core/storage/memory.py b/kinto/core/storage/memory.py index 296f2f3e7d..df0b9c3d83 100644 --- a/kinto/core/storage/memory.py +++ b/kinto/core/storage/memory.py @@ -322,8 +322,8 @@ def extract_record_set(records, filters, sorting, paginated = {} for rule in pagination_rules: values = apply_filters(filtered, rule) - paginated.update(((x[id_field], x) for x in values)) - paginated = paginated.values() + paginated.update((id(x), x) for x in values) + paginated = list(paginated.values()) else: paginated = filtered