Revision f3327431 snf-common/synnefo/lib/commissioning/specificator.py

b/snf-common/synnefo/lib/commissioning/specificator.py
191 191
    def __repr__(self):
192 192
        return self.tostring(multiline=0, showopts=1)
193 193

  
194
    def show(self):
195
        showable = self.opts.get('show', True)
196
        return self._show() if showable else ''
197

  
198
    def _show(self):
199
        return self.name
194 200

  
195 201
class Null(Canonical):
196 202

  
......
535 541

  
536 542
    random_choice = random_listof
537 543

  
544
    def _show(self):
545
        return '[ ' + self.canonical.show() + ' ... ]'
538 546

  
539 547
class Args(Canonical):
540 548

  
......
578 586

  
579 587
        return canonified
580 588

  
589
    def _show(self):
590
        strings = [x for x in [c.show() for n, c in self.kw.items()] if x]
591
        return ' '.join(strings)
592

  
581 593
    def random_args(self, kw):
582 594
        args = {}
583 595
        for n, c in self.kw.items():
......
637 649

  
638 650
    random_choice = random_tuple
639 651

  
652
    def _show(self):
653
        canonicals = self.args
654
        strings = [x for x in [c.show() for c in canonicals] if x]
655
        return '[ ' + ' '.join(strings) + ' ]'
640 656

  
641 657
class Dict(Canonical):
642 658

  
......
753 769
    def canonify_output(self, name, the_output):
754 770
        return self.output_canonical(name)(the_output)
755 771

  
772
    def show_input_canonical(self, name):
773
        return self.input_canonical(name).show()
774

  
756 775
    def parse(self, method, arglist):
757 776
        args, rest = argmap_decode(arglist)
758 777
        argdict = self.input_canonical(method).parse(args)

Also available in: Unified diff