[PATCH 3/8] xmlrpc: fix max_count for check_list

Daniel Axtens dja at axtens.net
Sat Sep 3 17:07:15 AEST 2016


Negative values were broken due to some missing code. Fix it by adding
code based on an example from one of the other models.

Signed-off-by: Daniel Axtens <dja at axtens.net>
---
 patchwork/views/xmlrpc.py | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/patchwork/views/xmlrpc.py b/patchwork/views/xmlrpc.py
index 890db75c0a13..e47019c8b37c 100644
--- a/patchwork/views/xmlrpc.py
+++ b/patchwork/views/xmlrpc.py
@@ -933,6 +933,9 @@ def check_list(filt=None):
 
         if max_count > 0:
             return list(map(check_to_dict, checks[:max_count]))
+        elif max_count < 0:
+            min_count = checks.count() + max_count
+            return list(map(check_to_dict, checks[min_count:]))
         else:
             return list(map(check_to_dict, checks))
     except Check.DoesNotExist:
-- 
2.7.4



More information about the Patchwork mailing list