Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit115938b

Browse files
feat: add support for lists of integers to ListAttribute
Previously ListAttribute only support lists of integers. Now be moreflexible and support lists of items which can be coerced into strings,for example integers.This will help us fix issue#1407 by using ListAttribute for the'iids' field.
1 parente37de18 commit115938b

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

‎gitlab/tests/test_types.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,11 @@ def test_list_attribute_get_for_api_from_list():
5959
asserto.get_for_api()=="foo,bar,baz"
6060

6161

62+
deftest_list_attribute_get_for_api_from_int_list():
63+
o=types.ListAttribute([1,9,7])
64+
asserto.get_for_api()=="1,9,7"
65+
66+
6267
deftest_list_attribute_does_not_split_string():
6368
o=types.ListAttribute("foo")
6469
asserto.get_for_api()=="foo"

‎gitlab/types.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ def get_for_api(self):
4242
ifisinstance(self._value,str):
4343
returnself._value
4444

45-
return",".join(self._value)
45+
return",".join([str(x)forxinself._value])
4646

4747

4848
classLowercaseStringAttribute(GitlabAttribute):

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp