mirror of
https://github.com/openSUSE/osc.git
synced 2024-11-10 06:46:15 +01:00
python3 compatibility: has_key
don't use method removed from python3
This commit is contained in:
parent
19f689ce0b
commit
2ad4a8c873
@ -478,7 +478,7 @@ def main(apiurl, opts, argv):
|
||||
if val:
|
||||
if var.startswith('OSC_'): var = var[4:]
|
||||
var = var.lower().replace('_', '-')
|
||||
if config.has_key(var):
|
||||
if var in config:
|
||||
print 'Overriding config value for %s=\'%s\' with \'%s\'' % (var, config[var], val)
|
||||
config[var] = val
|
||||
|
||||
|
@ -6289,7 +6289,7 @@ Please submit there instead, or use --nodevelproject to force direct submission.
|
||||
pass
|
||||
|
||||
res = get_user_projpkgs(apiurl, user, role_filter, exclude_projects,
|
||||
what.has_key('project'), what.has_key('package'),
|
||||
'project' in what, 'package' in what,
|
||||
opts.maintained, opts.verbose)
|
||||
|
||||
# map of project =>[list of packages]
|
||||
@ -7046,7 +7046,7 @@ Please submit there instead, or use --nodevelproject to force direct submission.
|
||||
"""
|
||||
apiurl = self.get_api_url()
|
||||
if len(usernames) < 1:
|
||||
if not conf.config['api_host_options'][apiurl].has_key('user'):
|
||||
if 'user' not in conf.config['api_host_options'][apiurl]:
|
||||
raise oscerr.WrongArgs('your .oscrc does not have your user name.')
|
||||
usernames = (conf.config['api_host_options'][apiurl]['user'],)
|
||||
for name in usernames:
|
||||
@ -7595,7 +7595,7 @@ Please submit there instead, or use --nodevelproject to force direct submission.
|
||||
cmd_list = ['/usr/lib/build/vc']
|
||||
|
||||
# set user's email if no mailaddr exists
|
||||
if not os.environ.has_key('mailaddr'):
|
||||
if 'mailaddr' not in os.environ:
|
||||
|
||||
if len(args) and is_package_dir(args[0]):
|
||||
apiurl = store_read_apiurl(args[0])
|
||||
@ -7611,7 +7611,7 @@ Please submit there instead, or use --nodevelproject to force direct submission.
|
||||
print >>sys.stderr, 'Try env mailaddr=...'
|
||||
|
||||
# mailaddr can be overrided by config one
|
||||
if conf.config['api_host_options'][apiurl].has_key('email'):
|
||||
if 'email' in conf.config['api_host_options'][apiurl]:
|
||||
os.environ['mailaddr'] = conf.config['api_host_options'][apiurl]['email']
|
||||
|
||||
if meego_style:
|
||||
|
12
osc/core.py
12
osc/core.py
@ -838,7 +838,7 @@ class Project:
|
||||
try:
|
||||
for pac in pacs:
|
||||
todo = []
|
||||
if files.has_key(pac):
|
||||
if pac in files:
|
||||
todo = files[pac]
|
||||
state = self.get_state(pac)
|
||||
if state == 'A':
|
||||
@ -4927,7 +4927,7 @@ def get_results(apiurl, prj, package, lastbuild=None, repository=[], arch=[], ve
|
||||
continue
|
||||
|
||||
for res in results:
|
||||
if res.has_key('_oldstate'):
|
||||
if '_oldstate' in res:
|
||||
oldstate = res['_oldstate']
|
||||
continue
|
||||
res['status'] = res['code']
|
||||
@ -5066,7 +5066,7 @@ def get_prj_results(apiurl, prj, hide_legend=False, csv=False, status_filter=Non
|
||||
line.append(' ')
|
||||
for pac in pacs[startpac:startpac+max_pacs]:
|
||||
st = ''
|
||||
if not status.has_key(pac) or not status[pac].has_key(tg):
|
||||
if pac not in status or tg not in status[pac]:
|
||||
# for newly added packages, status may be missing
|
||||
st = '?'
|
||||
else:
|
||||
@ -5095,7 +5095,7 @@ def get_prj_results(apiurl, prj, hide_legend=False, csv=False, status_filter=Non
|
||||
line = []
|
||||
for tg in targets:
|
||||
st = ''
|
||||
if not status.has_key(pac) or not status[pac].has_key(tg):
|
||||
if pac not in status or tg not in status[pac]:
|
||||
# for newly added packages, status may be missing
|
||||
st = '?'
|
||||
else:
|
||||
@ -6539,9 +6539,9 @@ def get_user_projpkgs(apiurl, user, role=None, exclude_projects=[], proj=True, p
|
||||
raise e
|
||||
# backward compatibility: local role filtering
|
||||
what = dict([[kind, role_filter_xpath] for kind in what.keys()])
|
||||
if what.has_key('package'):
|
||||
if 'package' in what:
|
||||
what['package'] = xpath_join(role_filter_xpath, excl_pkg, op='and')
|
||||
if what.has_key('project'):
|
||||
if 'project' in what:
|
||||
what['project'] = xpath_join(role_filter_xpath, excl_prj, op='and')
|
||||
res = search(apiurl, **what)
|
||||
filter_role(res, user, role)
|
||||
|
Loading…
Reference in New Issue
Block a user