Skip to content

Commit eee4cce

Browse files
committed
Fix for #717: Rename of conflicting 'action' attribute; fallback for missing Event parameters.
1 parent 1792442 commit eee4cce

3 files changed

Lines changed: 5 additions & 5 deletions

File tree

gitlab/cli.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -165,12 +165,12 @@ def main():
165165
if args.fields:
166166
fields = [x.strip() for x in args.fields.split(',')]
167167
debug = args.debug
168-
action = args.action
168+
action = args.whaction
169169
what = args.what
170170

171171
args = args.__dict__
172172
# Remove CLI behavior-related args
173-
for item in ('gitlab', 'config_file', 'verbose', 'debug', 'what', 'action',
173+
for item in ('gitlab', 'config_file', 'verbose', 'debug', 'what', 'whaction',
174174
'version', 'output'):
175175
args.pop(item)
176176
args = {k: _parse_value(v) for k, v in args.items() if v is not None}

gitlab/tests/test_cli.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ def test_parse_args(self):
111111
parser = cli._get_parser(gitlab.v4.cli)
112112
args = parser.parse_args(['project', 'list'])
113113
self.assertEqual(args.what, 'project')
114-
self.assertEqual(args.action, 'list')
114+
self.assertEqual(args.whaction, 'list')
115115

116116
def test_parser(self):
117117
parser = cli._get_parser(gitlab.v4.cli)

gitlab/v4/cli.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -273,7 +273,7 @@ def extend_parser(parser):
273273

274274
object_subparsers = object_group.add_subparsers(
275275
title='action',
276-
dest='action', help="Action to execute.")
276+
dest='whaction', help="Action to execute.")
277277
_populate_sub_parser_by_class(cls, object_subparsers)
278278
object_subparsers.required = True
279279

@@ -357,7 +357,7 @@ def display_dict(d, padding):
357357
id = getattr(obj, obj._id_attr)
358358
print('%s: %s' % (obj._id_attr.replace('_', '-'), id))
359359
if hasattr(obj, '_short_print_attr'):
360-
value = getattr(obj, obj._short_print_attr)
360+
value = getattr(obj, obj._short_print_attr) or 'None'
361361
value = value.replace('\r', '').replace('\n', ' ')
362362
# If the attribute is a note (ProjectCommitComment) then we do
363363
# some modifications to fit everything on one line

0 commit comments

Comments
 (0)