@@ -28,7 +28,12 @@ class BugzillaError(Exception):
2828 pass
2929
3030
31- class _BugzillaToken (object ):
31+ class _BugzillaTokenCache (object ):
32+ """
33+ Cache for tokens, including, with apologies for the duplicative
34+ terminology, both Bugzilla Tokens and API Keys.
35+ """
36+
3237 def __init__ (self , uri , tokenfilename ):
3338 self .tokenfilename = tokenfilename
3439 self .tokenfile = SafeConfigParser ()
@@ -63,33 +68,33 @@ def value(self, value):
6368 self .tokenfile .write (tokenfile )
6469
6570 def __repr__ (self ):
66- return '<Bugzilla Token :: %s>' % ( self .value )
71+ return '<Bugzilla Token Cache :: %s>' % self .value
6772
6873
6974class _BugzillaServerProxy (ServerProxy ):
7075 def __init__ (self , uri , tokenfile , * args , ** kwargs ):
7176 # pylint: disable=super-init-not-called
7277 # No idea why pylint complains here, must be a bug
7378 ServerProxy .__init__ (self , uri , * args , ** kwargs )
74- self .token = _BugzillaToken (uri , tokenfile )
79+ self .token_cache = _BugzillaTokenCache (uri , tokenfile )
7580
7681 def clear_token (self ):
77- self .token .value = None
82+ self .token_cache .value = None
7883
7984 def _ServerProxy__request (self , methodname , params ):
80- if self .token .value is not None :
85+ if self .token_cache .value is not None :
8186 if len (params ) == 0 :
8287 params = ({}, )
8388
8489 if 'Bugzilla_token' not in params [0 ]:
85- params [0 ]['Bugzilla_token' ] = self .token .value
90+ params [0 ]['Bugzilla_token' ] = self .token_cache .value
8691
8792 # pylint: disable=maybe-no-member
8893 ret = ServerProxy ._ServerProxy__request (self , methodname , params )
8994 # pylint: enable=maybe-no-member
9095
9196 if isinstance (ret , dict ) and 'token' in ret .keys ():
92- self .token .value = ret .get ('token' )
97+ self .token_cache .value = ret .get ('token' )
9398 return ret
9499
95100
0 commit comments