From patchwork Wed Sep 29 09:33:14 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?b?THVrw6HFoSBEb2t0b3I=?= X-Patchwork-Id: 216782 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter1.kernel.org (8.14.4/8.14.3) with ESMTP id o8T9XN3t007587 for ; Wed, 29 Sep 2010 09:33:23 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751469Ab0I2JdW (ORCPT ); Wed, 29 Sep 2010 05:33:22 -0400 Received: from mx1.redhat.com ([209.132.183.28]:15999 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751333Ab0I2JdV (ORCPT ); Wed, 29 Sep 2010 05:33:21 -0400 Received: from int-mx02.intmail.prod.int.phx2.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id o8T9XKEF029067 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Wed, 29 Sep 2010 05:33:20 -0400 Received: from dhcp-27-189.brq.redhat.com (dhcp-27-189.brq.redhat.com [10.34.27.189]) by int-mx02.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id o8T9XG1C031913; Wed, 29 Sep 2010 05:33:18 -0400 From: Lukas Doktor To: ldoktor@redhat.com, jzupka@redhat.com, autotest@test.kernel.org, kvm@vger.kernel.org, lmr@redhat.com Subject: [PATCH] FIX matrix_to_string: header columns width ADD matrix_to_string: accept header of type tupple or list Date: Wed, 29 Sep 2010 11:33:14 +0200 Message-Id: <1285752794-17191-2-git-send-email-ldoktor@redhat.com> In-Reply-To: <1285752794-17191-1-git-send-email-ldoktor@redhat.com> References: <1285752794-17191-1-git-send-email-ldoktor@redhat.com> X-Scanned-By: MIMEDefang 2.67 on 10.5.11.12 Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.3 (demeter1.kernel.org [140.211.167.41]); Wed, 29 Sep 2010 09:33:24 +0000 (UTC) diff --git a/client/common_lib/utils.py b/client/common_lib/utils.py index f44dd1e..6b8cdf6 100644 --- a/client/common_lib/utils.py +++ b/client/common_lib/utils.py @@ -211,9 +211,14 @@ def matrix_to_string(matrix, header=None): in each column, and determining the format string dynamically. @param matrix: Matrix representation (list with n rows of m elements). - @param header: Optional tuple with header elements to be displayed. + @param header: Optional tuple or list with header elements to be displayed. """ + if type(header) is list: + header = tuple(header) lengths = [] + if header: + for column in header: + lengths.append(len(column)) for row in matrix: for column in row: i = row.index(column)