[python-bugzilla] [PATCH] Ensure Bugzilla_token is set when no args present

abn at redhat.com abn at redhat.com
Thu Apr 24 05:56:01 UTC 2014


From: Arun Babu Neelicattu <abn at redhat.com>

Thanks to Simon Baird for pointing out the issue.
---
 bugzilla/base.py | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/bugzilla/base.py b/bugzilla/base.py
index f026709..31cfc51 100644
--- a/bugzilla/base.py
+++ b/bugzilla/base.py
@@ -153,9 +153,12 @@ class _BugzillaServerProxy(ServerProxy):
         self.token.value = None
 
     def _ServerProxy__request(self, methodname, params):
-        if (self.token.value is not None and len(params) == 1
-            and 'Bugzilla_token' not in params[0]):
-            params[0]['Bugzilla_token'] = self.token.value
+        if self.token.value is not None:
+            if len(params) == 0:
+                params = ({}, )
+
+            if 'Bugzilla_token' not in params[0]:
+                params[0]['Bugzilla_token'] = self.token.value
 
         # pylint: disable=maybe-no-member
         ret = ServerProxy._ServerProxy__request(self, methodname, params)
-- 
1.9.0



More information about the python-bugzilla mailing list