Commit eee4ccea authored by xarx00's avatar xarx00
Browse files

Fix for #717: Rename of conflicting 'action' attribute; fallback for missing Event parameters.

parent 17924424
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -165,12 +165,12 @@ def main():
    if args.fields:
        fields = [x.strip() for x in args.fields.split(',')]
    debug = args.debug
    action = args.action
    action = args.whaction
    what = args.what

    args = args.__dict__
    # Remove CLI behavior-related args
    for item in ('gitlab', 'config_file', 'verbose', 'debug', 'what', 'action',
    for item in ('gitlab', 'config_file', 'verbose', 'debug', 'what', 'whaction',
                 'version', 'output'):
        args.pop(item)
    args = {k: _parse_value(v) for k, v in args.items() if v is not None}
+1 −1
Original line number Diff line number Diff line
@@ -111,7 +111,7 @@ class TestV4CLI(unittest.TestCase):
        parser = cli._get_parser(gitlab.v4.cli)
        args = parser.parse_args(['project', 'list'])
        self.assertEqual(args.what, 'project')
        self.assertEqual(args.action, 'list')
        self.assertEqual(args.whaction, 'list')

    def test_parser(self):
        parser = cli._get_parser(gitlab.v4.cli)
+2 −2
Original line number Diff line number Diff line
@@ -273,7 +273,7 @@ def extend_parser(parser):

        object_subparsers = object_group.add_subparsers(
            title='action',
            dest='action', help="Action to execute.")
            dest='whaction', help="Action to execute.")
        _populate_sub_parser_by_class(cls, object_subparsers)
        object_subparsers.required = True

@@ -357,7 +357,7 @@ class LegacyPrinter(object):
                id = getattr(obj, obj._id_attr)
                print('%s: %s' % (obj._id_attr.replace('_', '-'), id))
            if hasattr(obj, '_short_print_attr'):
                value = getattr(obj, obj._short_print_attr)
                value = getattr(obj, obj._short_print_attr) or 'None'
                value = value.replace('\r', '').replace('\n', ' ')
                # If the attribute is a note (ProjectCommitComment) then we do
                # some modifications to fit everything on one line