better variable naming
This commit is contained in:
parent
13097dff36
commit
b7a05820f5
1 changed files with 12 additions and 12 deletions
|
|
@ -65,24 +65,24 @@ class SidetagOwnerTest(koji.policy.MatchTest):
|
|||
name = 'is_sidetag_owner'
|
||||
|
||||
def run(self, data):
|
||||
values = self.str.split()[1:]
|
||||
if len(values) > 1:
|
||||
fields = self.str.split()[1:]
|
||||
if len(fields) > 1:
|
||||
raise koji.GenericError("Just one argument is allowed for this test.")
|
||||
elif values:
|
||||
value = values[0]
|
||||
if value not in ('tag', 'fromtag', 'both'):
|
||||
elif fields:
|
||||
key = fields[0]
|
||||
if key not in ('tag', 'fromtag', 'both'):
|
||||
raise koji.GenericError("Policy test is_sidetag_owner has only "
|
||||
f"/tag/fromtag/both options (got {value})")
|
||||
if value == 'both':
|
||||
values = ['tag', 'fromtag']
|
||||
f"/tag/fromtag/both options (got {key})")
|
||||
if key == 'both':
|
||||
fields = ['tag', 'fromtag']
|
||||
else:
|
||||
values = ['tag']
|
||||
fields = ['tag']
|
||||
|
||||
user = policy_get_user(data)
|
||||
for value in values:
|
||||
if value not in data:
|
||||
for field in fields:
|
||||
if field not in data:
|
||||
return False
|
||||
tag = get_tag(value)
|
||||
tag = get_tag(data[field])
|
||||
if not tag or not is_sidetag_owner(tag, user):
|
||||
return False
|
||||
return True
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue