From c6a5245ca191e987341859ca640d8ab9be3710ba Mon Sep 17 00:00:00 2001 From: oysteini Date: Mon, 27 Sep 2010 17:39:35 +0000 Subject: [PATCH] =?UTF-8?q?Forbedret=20printing=20av=20s=C3=B8keresultater?= =?UTF-8?q?.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Nå får forfatterne også være med! --- python/search.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/python/search.py b/python/search.py index f5a5c1f..46b6b12 100644 --- a/python/search.py +++ b/python/search.py @@ -6,13 +6,14 @@ from util import * def search_book_cmd(search_strings, search_description=False): books = search_book(search_strings, search_description) - format = '%13s %10s %-40s %15s' + format = '%-13s %-10s %-40s %-30s' for book in books: b_id = book.getid() or '' title = cut_str(book.title, 40) - # TODO author - author = '' - print format % (book.isbn, b_id, title, author) + authors = map(lambda p: p.first_name+' '+p.last_name, + book.get_authors()) + authors_str = cut_str(', '.join(authors), 30) + print format % (book.isbn, b_id, title, authors_str) def search_book(search_strings, search_description=False): basic_query = Book.objects