Skip to content

Commit

Permalink
ipalib/frontend.py output_for_cli loops optimization
Browse files Browse the repository at this point in the history
Trivial fix which removes unnecessary for loops.

Reviewed-By: Christian Heimes <cheimes@redhat.com>
  • Loading branch information
Aleksei Slaikovskii authored and tiran committed Nov 23, 2017
1 parent 4af36de commit 197b5ca
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions ipalib/frontend.py
Original file line number Diff line number Diff line change
Expand Up @@ -1041,7 +1041,15 @@ def output_for_cli(self, textui, output, *args, **options):

self.log_messages(output)

order = [p.name for p in self.output_params()]
order = []
labels = {}
flags = {}

for p in self.output_params():
order.append(p.name)
labels[p.name] = unicode(p.label)
flags[p.name] = p.flags

if options.get('all', False):
order.insert(0, 'dn')
print_all = True
Expand All @@ -1050,9 +1058,6 @@ def output_for_cli(self, textui, output, *args, **options):

if options.get('raw', False):
labels = None
else:
labels = dict((p.name, unicode(p.label)) for p in self.output_params())
flags = dict((p.name, p.flags) for p in self.output_params())

for o in self.output:
outp = self.output[o]
Expand Down

0 comments on commit 197b5ca

Please sign in to comment.