]> arthur.barton.de Git - bup.git/commit - lib/bup/helpers.py
fix helpers.columnate bug when list is empty
authorGabriel Filion <lelutin@gmail.com>
Sun, 25 Jul 2010 17:34:13 +0000 (13:34 -0400)
committerAvery Pennarun <apenwarr@gmail.com>
Mon, 26 Jul 2010 03:09:31 +0000 (23:09 -0400)
commitd349af0005f6b4181544a99729023d5b413213cf
tree6ad295ee84c440b78827c96c3d465b3ebbcf6a67
parent8cf4d01ac63aaa0219f2accecf76bc8938c90d85
fix helpers.columnate bug when list is empty

When the list given to the columnate function is empty, the function
raises an exception when determining the max(len of all elements), since
the list given to max is empty.

One indirect example of when this bug is apparent is in the 'bup ftp'
command when listing an empty directory:

    bup> ls backupname/latest/etc/keys
    error: max() arg is an empty sequence

Add a special condition at the beginning of the columnate function that
returns an empty string if the list of elements is empty.

Signed-off-by: Gabriel Filion <lelutin@gmail.com>
lib/bup/helpers.py