=== modified file 'mandos-ctl' --- mandos-ctl 2019-03-02 02:17:17 +0000 +++ mandos-ctl 2019-03-02 02:33:00 +0000 @@ -269,9 +269,6 @@ return value -def print_clients(clients, keywords): - print('\n'.join(TableOfClients(clients, keywords).rows())) - class TableOfClients(object): tablewords = { "Name": "Name", @@ -302,6 +299,14 @@ if tablewords is not None: self.tablewords = tablewords + def __str__(self): + return "\n".join(self.rows()) + + if sys.version_info.major == 2: + __unicode__ = __str__ + def __str__(self): + return str(self).encode(locale.getpreferredencoding()) + def rows(self): format_string = self.row_formatting_string() rows = [self.header_line(format_string)] @@ -501,7 +506,7 @@ separators=(',', ': ')) print() else: - print_clients(clients.values(), keywords) + print(TableOfClients(clients.values(), keywords)) else: # Process each client in the list by all selected options for client in clients: