From 9c58013a269d3da2beec947a152605fc3c926577 Mon Sep 17 00:00:00 2001 From: Gauvain Pocentek Date: Sat, 19 Sep 2015 11:56:50 +0200 Subject: Fix GET/POST for project files --- gitlab/cli.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'gitlab/cli.py') diff --git a/gitlab/cli.py b/gitlab/cli.py index 68a589f..a1109b6 100644 --- a/gitlab/cli.py +++ b/gitlab/cli.py @@ -82,9 +82,10 @@ def populate_sub_parser_by_class(cls, sub_parser): elif action_name in [GET, DELETE]: if cls not in [gitlab.CurrentUser]: - id_attr = cls.idAttr.replace('_', '-') - sub_parser_action.add_argument("--%s" % id_attr, - required=True) + if cls.getRequiresId: + id_attr = cls.idAttr.replace('_', '-') + sub_parser_action.add_argument("--%s" % id_attr, + required=True) [sub_parser_action.add_argument("--%s" % x.replace('_', '-'), required=True) for x in cls.requiredGetAttrs] @@ -172,7 +173,7 @@ def do_get(cls, gl, what, args): die("%s objects can't be retrieved" % what) id = None - if cls not in [gitlab.CurrentUser]: + if cls not in [gitlab.CurrentUser] and cls.getRequiresId: id = get_id(cls, args) try: -- cgit v1.2.1