99# option) any later version. See http://www.gnu.org/copyleft/gpl.html for
1010# the full text of the license.
1111
12- import cookielib
1312import os
1413import re
1514import time
@@ -30,8 +29,7 @@ class NovellBugzilla(Bugzilla34):
3029 HTTP requests, NovellBugzilla caches the session cookies of bugzilla
3130 and IChain in a cookiejar to speedup a repeated connections.
3231 To avoid problems with cookie expiration, it set the expiration of cookie
33- to 5 minutes. This expects cookies stored in LWPCookieJar format and
34- login method warn if cookies are in MozillaCookieJar format.
32+ to 5 minutes.
3533
3634 It can also read a credentials from ~/.oscrc if exists, so it should not
3735 be duplicated in /etc/bugzillarc, or ~/.bugzillarc.
@@ -87,24 +85,13 @@ def _is_ichain_cookie(self):
8785 return len ([c for c in self ._iter_domain_cookies () if
8886 self .__class__ .ichain_cookie_re .match (c .name )]) != 0
8987
90- def _is_lwp_format (self ):
91- return isinstance (self ._cookiejar , cookielib .LWPCookieJar )
92-
9388 def _login (self , user , password ):
9489 cls = self .__class__
9590
9691 # remove /xmlrpc.cgi
9792 base_url = self .url [:- 11 ]
9893
99- lwp_format = self ._is_lwp_format ()
100- if not lwp_format :
101- log .warn ("File `%s' is not in LWP format required for "
102- "NovellBugzilla. If you want cache the cookies "
103- "and speedup the repeated connections, remove it "
104- "or use an another file for cookies." ,
105- self .cookiefile )
106-
107- if lwp_format and not self ._is_bugzilla_cookie ():
94+ if not self ._is_bugzilla_cookie ():
10895 login_url = urlparse .urljoin (base_url , cls .login_path )
10996 log .info ("GET %s" % login_url )
11097 login_resp = self ._opener .open (login_url )
@@ -122,7 +109,7 @@ def _login(self, user, password):
122109 'password' : password ,
123110 }
124111
125- if lwp_format and not self ._is_ichain_cookie ():
112+ if not self ._is_ichain_cookie ():
126113 auth_url = urlparse .urljoin (base_url , cls .auth_path )
127114 auth_params = urllib .urlencode (params )
128115 auth_req = urllib2 .Request (auth_url , auth_params )
@@ -132,11 +119,10 @@ def _login(self, user, password):
132119 raise BugzillaError ("The auth failed with code %d" %
133120 auth_resp .core )
134121
135- if lwp_format :
136- for cookie in self ._cookiejar :
137- # expires cookie in 15 minutes
138- cookie .expires = time .time () + self ._expires
139- cookie .discard = False
122+ for cookie in self ._cookiejar :
123+ # expires cookie in 15 minutes
124+ cookie .expires = time .time () + self ._expires
125+ cookie .discard = False
140126
141127 return super (NovellBugzilla , self )._login (user , password )
142128
0 commit comments