Skip to content

Commit 5ffa1b2

Browse files
AdamWillcrobinso
authored andcommitted
build_update: don't convert 'blocks' or 'depends' to int
This is not necessary - Bugzilla, at least the current version on bugzilla.redhat.com, is happy to accept IDs as a string. It also causes a problem: this prevents you from using aliases when setting blocks or depends, which is often very convenient when bugs have predictable aliases (like "F40Changes" or "F39BetaBlocker"). Without this change, you have to do an extra query just to find the ID of the bug. Signed-off-by: Adam Williamson <awilliam@redhat.com>
1 parent a890ad0 commit 5ffa1b2

3 files changed

Lines changed: 8 additions & 16 deletions

File tree

bugzilla/base.py

Lines changed: 5 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1493,19 +1493,13 @@ def add_dict(key, add, remove, _set=None, convert=None):
14931493
if add is remove is _set is None:
14941494
return
14951495

1496-
def c(val):
1497-
val = listify(val)
1498-
if convert:
1499-
val = [convert(v) for v in val]
1500-
return val
1501-
15021496
newdict = {}
15031497
if add is not None:
1504-
newdict["add"] = c(add)
1498+
newdict["add"] = listify(add)
15051499
if remove is not None:
1506-
newdict["remove"] = c(remove)
1500+
newdict["remove"] = listify(remove)
15071501
if _set is not None:
1508-
newdict["set"] = c(_set)
1502+
newdict["set"] = listify(_set)
15091503
ret[key] = newdict
15101504

15111505

@@ -1539,10 +1533,8 @@ def c(val):
15391533
s("comment_tags", comment_tags, listify)
15401534
s("minor_update", minor_update, bool)
15411535

1542-
add_dict("blocks", blocks_add, blocks_remove, blocks_set,
1543-
convert=int)
1544-
add_dict("depends_on", depends_on_add, depends_on_remove,
1545-
depends_on_set, convert=int)
1536+
add_dict("blocks", blocks_add, blocks_remove, blocks_set)
1537+
add_dict("depends_on", depends_on_add, depends_on_remove, depends_on_set)
15461538
add_dict("cc", cc_add, cc_remove)
15471539
add_dict("groups", groups_add, groups_remove)
15481540
add_dict("keywords", keywords_add, keywords_remove, keywords_set)

tests/data/mockargs/test_modify2.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
(['123456'],
2-
{'blocks': {'set': [123456, 445566]},
2+
{'blocks': {'set': ['123456', '445566']},
33
'comment': {'comment': 'some example comment', 'is_private': True},
44
'component': 'NEWCOMP',
55
'dupe_of': 555666,

tests/data/mockargs/test_modify5.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,13 @@
22
{'alias': 'fooalias',
33
'assigned_to': 'foo@example.com',
44
'bar': 'foo',
5-
'blocks': {'add': [1234], 'remove': [1235], 'set': []},
5+
'blocks': {'add': ['1234'], 'remove': ['1235'], 'set': []},
66
'cc': {'add': ['+bar@example.com'], 'remove': ['steve@example.com']},
77
'cf_devel_whiteboard': 'DEVBOARD',
88
'cf_internal_whiteboard': 'INTBOARD',
99
'cf_qa_whiteboard': 'QABOARD',
1010
'comment_tags': ['FOOTAG'],
11-
'depends_on': {'add': [2234], 'remove': [2235], 'set': []},
11+
'depends_on': {'add': ['2234'], 'remove': ['2235'], 'set': []},
1212
'groups': {'add': ['foogroup']},
1313
'keywords': {'add': ['newkeyword'], 'remove': ['byekeyword'], 'set': []},
1414
'minor_update': True,

0 commit comments

Comments
 (0)