Michael Pasternak has posted comments on this change.

Change subject: cli: x-identifier auto-completion doesn't work in 
permissions(#1027281)
......................................................................


Patch Set 4: Code-Review-1

(3 comments)

....................................................
File src/ovirtcli/shell/addcmdshell.py
Line 46:     def complete_add(self, text, line, begidx, endidx):
Line 47:         args = TypeHelper.get_types_by_method(False,
Line 48:                                               AddCmdShell.NAME,
Line 49:                                               expendNestedTypes=True,
Line 50:                                               
obj_decorator_type=self.get_obj_decorator_type(line))
why it's only for /add?
Line 51: 
Line 52:         specific_options = self.get_resource_specific_options(args, 
line,
Line 53:                                                               
callback=self.__add_resource_specific_options)


....................................................
File src/ovirtcli/shell/cmdshell.py
Line 124:                 base = self._resolve_base(spl[1:])
Line 125:                 if base:
Line 126:                     obj = base
Line 127:             elif len(spl) == 2 and spl[1] != '':
Line 128:                 obj = spl[1].strip()
what is the use-case for this if?
Line 129:             if obj is not None:
Line 130:                 obj_decorator_type = 
TypeHelper.getDecoratorType(TypeHelper.to_plural(obj))
Line 131: 
Line 132:         return obj_decorator_type


....................................................
File src/ovirtcli/utils/typehelper.py
Line 118:         if method:
Line 119:             for decorator in TypeHelper.getKnownDecoratorsTypes():
Line 120:                 dct = getattr(brokers, decorator).__dict__
Line 121:                 if dct.has_key(method):
Line 122:                     if decorator.endswith('s') and 
(obj_decorator_type is None or decorator == obj_decorator_type):
ravi,

if you know the decorator ahead, there is no more point in this loop (unless 
it's None),
you can just proceed to the L123 (just make sure it's collection),

also i'd move get_obj_decorator_type() to this class and always invoke it what 
will make it available for other auto-completion contexts (if parent is 
specified).
Line 123:                         cls_name = 
TypeHelper.getDecoratorType(decorator[:len(decorator) - 1])
Line 124:                         if cls_name:
Line 125:                             MethodHelper.get_method_params(brokers,
Line 126:                                                            cls_name,


-- 
To view, visit http://gerrit.ovirt.org/21513
To unsubscribe, visit http://gerrit.ovirt.org/settings

Gerrit-MessageType: comment
Gerrit-Change-Id: I3af7a66a1cd403f6506cf8a3ce00f8a63d9effd3
Gerrit-PatchSet: 4
Gerrit-Project: ovirt-engine-cli
Gerrit-Branch: master
Gerrit-Owner: Ravi Nori <rn...@redhat.com>
Gerrit-Reviewer: Michael Pasternak <mpast...@redhat.com>
Gerrit-Reviewer: Ravi Nori <rn...@redhat.com>
Gerrit-HasComments: Yes
_______________________________________________
Engine-patches mailing list
Engine-patches@ovirt.org
http://lists.ovirt.org/mailman/listinfo/engine-patches

Reply via email to