From 539b6596dc1bf1d3118631095625e354026da373 Mon Sep 17 00:00:00 2001 From: Jeremy Kerr Date: Mon, 18 Jul 2011 21:46:08 +0800 Subject: [PATCH] xmlrpc: do slice before patch_to_dict Currently, we map patch_to_dict before we slice the results (to only return max_count patches). This means that we hacve to retrieve all patches, then throw away most of the results of the map. This change does the slice on the patches before the map, letting django do a LIMIT-ed query instead. Signed-off-by: Jeremy Kerr --- apps/patchwork/views/xmlrpc.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/patchwork/views/xmlrpc.py b/apps/patchwork/views/xmlrpc.py index bb9ebe1..283eb34 100644 --- a/apps/patchwork/views/xmlrpc.py +++ b/apps/patchwork/views/xmlrpc.py @@ -328,7 +328,7 @@ def patch_list(filter={}): patches = Patch.objects.filter(**dfilter) if max_count > 0: - return map(patch_to_dict, patches)[:max_count] + return map(patch_to_dict, patches[:max_count]) else: return map(patch_to_dict, patches) -- 2.39.2