Michael Pasternak has posted comments on this change.

Change subject: cli: list xxx --show all - output is not well formatted(#890038)
......................................................................


Patch Set 2: Code-Review-1

(2 comments)

....................................................
File src/ovirtcli/format/text.py
Line 231: 
Line 232:         for resource in collection:
Line 233:             width0 = -1
Line 234:             if mode == FormatMode.FULL:
Line 235:                 fields = self.sort_fields(self._get_fields(resource), 
sort_strategy)
you don't need to sort in this context (this is done at _format_resource())

all you need is to find largest /value width among all objects in collection
Line 236:                 width0 = 
self.__get_max_field_width((resource.superclass if isinstance(resource, Base)
Line 237:                                                                       
   else resource),
Line 238:                                                     fields_exceptions,
Line 239:                                                     -1, show_empty,


Line 252: 
Line 253:         for resource in collection:
Line 254:             if isinstance(resource, Base):
Line 255:                 self._format_resource(resource=resource.superclass,
Line 256:                                       
width=self._get_max_field_width_in_collection(collection, show_empty),
ravi,

why are you doing this in loop for every resource in collection?,

please calculate the width before the loop and pass constant to
the self._format_resource()

thanks.
Line 257:                                       mode=FormatMode.REDUCED if not 
show_empty
Line 258:                                                               else 
FormatMode.FULL)
Line 259:             else:
Line 260:                 self._format_resource(resource=resource,


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

Gerrit-MessageType: comment
Gerrit-Change-Id: Ibcaa28d3718f8dd0aceb3935ae2606713eee34e9
Gerrit-PatchSet: 2
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