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

Appearance settings

Commit e8823e9

Browse filesBrowse files
authored
Merge pull request python-gitlab#760 from kkoralsky/custom_cli_actions_fix
Custom cli actions fix
2 parents 84bcdc0 + 6158fd2 commit e8823e9
Copy full SHA for e8823e9

File tree

Expand file treeCollapse file tree

1 file changed

+5
-5
lines changed
Open diff view settings
Filter options
Expand file treeCollapse file tree

1 file changed

+5
-5
lines changed
Open diff view settings
Collapse file

‎gitlab/v4/cli.py‎

Copy file name to clipboardExpand all lines: gitlab/v4/cli.py
+5-5Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -80,10 +80,10 @@ def do_custom(self):
8080
if gitlab.mixins.GetWithoutIdMixin not in inspect.getmro(self.cls):
8181
data[self.cls._id_attr] = self.args.pop(self.cls._id_attr)
8282
o = self.cls(self.mgr, data)
83-
method_name = self.action.replace('-', '_')
84-
return getattr(o, method_name)(**self.args)
8583
else:
86-
return getattr(self.mgr, self.action)(**self.args)
84+
o = self.mgr
85+
method_name = self.action.replace('-', '_')
86+
return getattr(o, method_name)(**self.args)
8787

8888
def do_project_export_download(self):
8989
try:
@@ -217,14 +217,14 @@ def _populate_sub_parser_by_class(cls, sub_parser):
217217
for x in mgr_cls._from_parent_attrs]
218218
sub_parser_action.add_argument("--sudo", required=False)
219219

220+
required, optional, needs_id = cli.custom_actions[name][action_name]
220221
# We need to get the object somehow
221-
if gitlab.mixins.GetWithoutIdMixin not in inspect.getmro(cls):
222+
if needs_id and gitlab.mixins.GetWithoutIdMixin not in inspect.getmro(cls):
222223
if cls._id_attr is not None:
223224
id_attr = cls._id_attr.replace('_', '-')
224225
sub_parser_action.add_argument("--%s" % id_attr,
225226
required=True)
226227

227-
required, optional, dummy = cli.custom_actions[name][action_name]
228228
[sub_parser_action.add_argument("--%s" % x.replace('_', '-'),
229229
required=True)
230230
for x in required if x != cls._id_attr]

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.