[Freeipa-devel] [PATCH] Fix output of commands, that do not return entries.

Rob Crittenden rcritten at redhat.com
Wed Mar 24 14:18:47 UTC 2010


Pavel Zůna wrote:
> Pavel Zůna wrote:
>> This patch fixes Command.output_for_cli for the env plugin. Before we 
>> assumed, that a list/tuple is always a list of entries and a dict is 
>> always an entry.
>>
>> Still, this solution isn't perfect. I think, that in the future, we 
>> should allow Output subclasses to control the way we output values 
>> instead of doing type-based output in Command.output_for_cli.
>>
>> Pavel
> Before anyone asks... :)
> 
> I also changed the default value of the print_all argument in 
> textui.print_entry from False to True. It think it makes more sense this 
> way, because:
> 1) if order is None, it will still print something
> 2) if order is not None, it will print what's in order first and then 
> the rest
> 3) commands that care about the print_all argument have to set it in any 
> case, those that don't care usually want to print everything

Why not set the default for print_all in print_entries() to True as well?

Seems like this reasoning should be documented in the function as well. 
Particularly how print_all gets handled when one returns Entries or a 
ListOfEntries vs just returning a dict/tuple (where --all controls 
whether everything is printed in the former and defaults to everything 
in the later assuming print_entries also ends up defaulting to True).

rob




More information about the Freeipa-devel mailing list