[python-bugzilla] [Patch] Fix ability to not save session cookies to disk

Toshio Kuratomi a.badger at gmail.com
Wed May 28 20:36:16 UTC 2014


The switch to requests in python-bugzilla seems to have broken the ability
to use python-bugzilla without a persistent cookie store.  The configuration
of requests in the code is telling requests not to use cookies at all when
what we want is just for requests to not save the cookies to a file on disk.

The attached patch should fix that.

-Toshio
-------------- next part --------------
From 8e6d4179546a084610e583dc6d36bd4d0ade8c1b Mon Sep 17 00:00:00 2001
From: Toshio Kuratomi <toshio at fedoraproject.org>
Date: Wed, 28 May 2014 13:32:40 -0700
Subject: [PATCH] If we specify None for cookiefile, then we don't want cookies
 saved to disk.  They still have to be used within the process though.

---
 bugzilla/base.py | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/bugzilla/base.py b/bugzilla/base.py
index 84d4be3..bea7112 100644
--- a/bugzilla/base.py
+++ b/bugzilla/base.py
@@ -181,6 +181,8 @@ class RequestsTransport(Transport):
             Transport.__init__(self, use_datetime=False)
 
         self.verbose = debug
+        if cookiejar is None:
+            cookiejar = _build_cookiejar(None)
         self._cookiejar = cookiejar
 
         # transport constructor needs full url too, as xmlrpc does not pass
@@ -193,7 +195,7 @@ class RequestsTransport(Transport):
 
         self.request_defaults = {
             'cert': sslcafile if self.use_https else None,
-            'cookies': cookiejar if cookiejar else None,
+            'cookies': cookiejar,
             'verify': sslverify,
             'headers': {
                 'Content-Type': 'text/xml',
-- 
1.9.3

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 181 bytes
Desc: not available
URL: <https://lists.fedorahosted.org/pipermail/python-bugzilla/attachments/20140528/6adb2350/attachment.sig>


More information about the python-bugzilla mailing list