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

Commit9c58013

Browse files
author
Gauvain Pocentek
committed
Fix GET/POST for project files
1 parent3270865 commit9c58013

File tree

2 files changed

+9
-5
lines changed

2 files changed

+9
-5
lines changed

‎gitlab/__init__.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -675,6 +675,8 @@ class GitlabObject(object):
675675
requiredUpdateAttrs=None
676676
#: Attributes that are optional when updating an object
677677
optionalUpdateAttrs=None
678+
#: Whether the object ID is required in the GET url
679+
getRequiresId=True
678680

679681
idAttr='id'
680682
shortPrintAttr=None
@@ -1134,7 +1136,8 @@ class ProjectFile(GitlabObject):
11341136
optionalCreateAttrs= ['encoding']
11351137
requiredDeleteAttrs= ['branch_name','commit_message']
11361138
getListWhenNoId=False
1137-
shortPrintAttr='name'
1139+
shortPrintAttr='file_path'
1140+
getRequiresId=False
11381141

11391142

11401143
classProjectSnippetNote(GitlabObject):

‎gitlab/cli.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -82,9 +82,10 @@ def populate_sub_parser_by_class(cls, sub_parser):
8282

8383
elifaction_namein [GET,DELETE]:
8484
ifclsnotin [gitlab.CurrentUser]:
85-
id_attr=cls.idAttr.replace('_','-')
86-
sub_parser_action.add_argument("--%s"%id_attr,
87-
required=True)
85+
ifcls.getRequiresId:
86+
id_attr=cls.idAttr.replace('_','-')
87+
sub_parser_action.add_argument("--%s"%id_attr,
88+
required=True)
8889
[sub_parser_action.add_argument("--%s"%x.replace('_','-'),
8990
required=True)
9091
forxincls.requiredGetAttrs]
@@ -172,7 +173,7 @@ def do_get(cls, gl, what, args):
172173
die("%s objects can't be retrieved"%what)
173174

174175
id=None
175-
ifclsnotin [gitlab.CurrentUser]:
176+
ifclsnotin [gitlab.CurrentUser]andcls.getRequiresId:
176177
id=get_id(cls,args)
177178

178179
try:

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp