fix calls to _pick_format

This commit is contained in:
Adrian Sampson 2012-10-26 20:19:33 -07:00
parent 1ee304e105
commit ac8109bb5f
2 changed files with 3 additions and 4 deletions

View file

@ -409,7 +409,7 @@ def get_replacements():
# FIXME handle regex compilation errors
return [(re.compile(k), v) for (k, v) in pairs]
def _pick_format(album=False, fmt=None):
def _pick_format(album, fmt=None):
"""Pick a format string for printing Album or Item objects,
falling back to config options and defaults.
"""
@ -425,8 +425,7 @@ def print_obj(obj, lib, fmt=None):
format string. Otherwise, use the configured template.
"""
album = isinstance(obj, library.Album)
if not fmt:
fmt = _pick_format(album=album)
fmt = _pick_format(album, fmt)
if isinstance(fmt, Template):
template = fmt
else:

View file

@ -709,7 +709,7 @@ def list_items(lib, query, album, fmt):
"""Print out items in lib matching query. If album, then search for
albums instead of single items.
"""
tmpl = Template(fmt) if fmt else Template(ui._pick_format(config, album))
tmpl = Template(ui._pick_format(album, fmt))
if album:
for album in lib.albums(query):
ui.print_obj(album, lib, tmpl)