9f9ef00
From 0bd2517f92874c758ec30177c5df4ecdf222236b Mon Sep 17 00:00:00 2001
9f9ef00
From: Pavel Raiskup <praiskup@redhat.com>
9f9ef00
Date: Fri, 3 Dec 2021 13:41:53 +0100
9f9ef00
Subject: [PATCH] Query limit to be configurable
9f9ef00
9f9ef00
Red Hat Bugzilla applied policy that anonymous queries can get at most
9f9ef00
20 lines in the API output, and authenticated queries up to 1000.
9f9ef00
9f9ef00
So it is probably a good idea to "push" Red Hat maintainers to the
9f9ef00
authentication (interactive=True) a little bit more and set some
9f9ef00
reasonable default limit (limit=1000), otherwise the output will be very
9f9ef00
limited (and there's a risk that user misses some bugs thinking that the
9f9ef00
output is complete).
9f9ef00
9f9ef00
Both of those options can be changed in $HOME/.bugzrc.
9f9ef00
9f9ef00
Proposed:
9f9ef00
https://github.com/williamh/pybugz/pull/111
9f9ef00
---
9f9ef00
 bugz/settings.py     | 5 +++++
9f9ef00
 pybugz.d/redhat.conf | 2 ++
9f9ef00
 2 files changed, 7 insertions(+)
9f9ef00
9f9ef00
diff --git a/bugz/settings.py b/bugz/settings.py
9f9ef00
index c45481c..1666f38 100644
9f9ef00
--- a/bugz/settings.py
9f9ef00
+++ b/bugz/settings.py
9f9ef00
@@ -123,6 +123,11 @@ class Settings:
9f9ef00
             else:
9f9ef00
                 self.insecure = False
9f9ef00
 
9f9ef00
+        if not hasattr(self, 'limit'):
9f9ef00
+            if config.has_option(self.connection, 'limit'):
9f9ef00
+                self.limit = get_config_option(config.get, self.connection,
9f9ef00
+                                               'limit')
9f9ef00
+
9f9ef00
         if getattr(self, 'encoding', None) is not None:
9f9ef00
             log_info('The encoding option is deprecated.')
9f9ef00
 
9f9ef00
diff --git a/pybugz.d/redhat.conf b/pybugz.d/redhat.conf
9f9ef00
index 36712a5..ec9d293 100644
9f9ef00
--- a/pybugz.d/redhat.conf
9f9ef00
+++ b/pybugz.d/redhat.conf
9f9ef00
@@ -1,3 +1,5 @@
9f9ef00
 [RedHat]
9f9ef00
 base = https://bugzilla.redhat.com/xmlrpc.cgi
9f9ef00
 search_statuses = NEW, ASSIGNED, MODIFIED, ON_DEV, POST
9f9ef00
+interactive = True
9f9ef00
+limit = 1000
9f9ef00
-- 
9f9ef00
2.33.1
9f9ef00