On 04/22/2013 12:38 PM, 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
;-)
"""
:kwarg cookiefile: Location to save the session cookies so you don't have
to keep giving the library your username and password. This defaults
to ~/.bugzillacookies. If set to None, the library won't save the
cookies persistently.
"""
If you want to preserve the API, use a different value other than None as the
sentinel value for "Choose to use the default".
If you're willing to change the API please preserve the feature by choosing a
different sentinel value for that. However, in looking for the places in the
code where the sentinel value should be updated, it looks like that might be
broken atm.
Apologies, and good catch. I'll send a fix, please review.
- Cole