1
0
mirror of https://github.com/openSUSE/osc.git synced 2025-02-25 19:52:12 +01:00

- all necessary auth-information are available in the 'auth_dict' (so there's no need to fool around with the ConfigParser...)

This commit is contained in:
Marcus Hüwe 2008-03-18 13:51:57 +00:00
parent 3c3e961f4e
commit 303e5dcffc

View File

@ -115,17 +115,16 @@ def parse_apisrv_url(scheme, apisrv):
def get_apiurl_usr(apiurl):
"""
returns the user for this host - if this host does not exist in the
configfile the default user is returned.
internal auth_dict the default user is returned.
"""
import sys
scheme, apisrv = parse_apisrv_url(None, apiurl)
cp = get_configParser()
try:
return cp.get(apisrv, 'user')
except ConfigParser.NoSectionError:
if config['auth_dict'].has_key(apisrv):
return config['auth_dict'][apisrv]['user']
else:
print >>sys.stderr, 'section [\'%s\'] does not exist - using default user: \'%s\'' \
% (apisrv, config['user'])
return config['user']
return config['user']
def init_basicauth(config):
"""initialize urllib2 with the credentials for Basic Authentication"""