[python-bugzilla] [PATCH] bugzilla: use passed in cookies correctly

Cole Robinson crobinso at redhat.com
Mon Apr 22 19:04:41 UTC 2013


On 04/22/2013 02:56 PM, Don Zickus wrote:
> On Mon, Apr 22, 2013 at 09:38:47AM -0700, Toshio Kuratomi wrote:
>> On Mon, Apr 22, 2013 at 12:13:21PM -0400, Cole Robinson wrote:
>>> On 04/22/2013 11:56 AM, Don Zickus wrote:
>>>> When using the option --cookiefile for bugzilla, the cookiefile
>>>> override happens to late.  Use the passed in file during the
>>>> beginning of init.
>>>>
>>>> This is addressed by defaulting the cookiefile to None to simplify
>>>> the passed in argument code.  Then the Bugzilla init routine assigns
>>>> the default of ~/.bugzillacookies if cookiefile is None.
>>>>
>>>> This shouldn't affect any of the other scripts that do not use the
>>>> cookiefile as an arg.
>>>>
>>>> diff --git a/bugzilla/base.py b/bugzilla/base.py
>>>> index c2b9295..658fcc7 100644
>>>> --- a/bugzilla/base.py
>>>> +++ b/bugzilla/base.py
>>>> @@ -187,13 +187,14 @@ class BugzillaBase(object):
>>>>              url = url + '/xmlrpc.cgi'
>>>>          return url
>>>>  
>>>> -    def __init__(self, url=None, user=None, password=None,
>>>> -            cookiefile=os.path.expanduser('~/.bugzillacookies')):
>>>> +    def __init__(self, url=None, user=None, password=None, cookiefile=None):
>>>>          # Settings the user might want to tweak
>>>>          self.user = user or ''
>>>>          self.password = password or ''
>>>>          self.url = ''
>>>>  
>>>> +        if not cookiefile:
>>>> +            cookiefile = os.path.expanduser('~/.bugzillacookies')
>>>>          self._cookiefobj = None
>>>>          self._cookiejar = None
>>>>          self._cookiefile = -1
>>>>
>>>
>>> ACK, pushed now.
>>>
>> This breaks the documented behaviour of the API (and a feature I contributed
>> ;-)
> 
> Sorry about that.  Didn't realize it.  I updated the patch and now use ''
> as the default.  Hopefully that works now.
> 

I had already pushed your patch. I posted a follow up that does something
similar, Toshio ACK'd, and I pushed that. So I think .git is fine now.

Thanks,
Cole



More information about the python-bugzilla mailing list