Projects/worblehat-old
Projects
/
worblehat-old
Archived
12
0
Fork 0

Search-person skal nå fungere. Hurra!

This commit is contained in:
Øyvind Almelid 2010-09-29 19:50:52 +00:00
parent f4c9116ad8
commit 72ef23de26
1 changed files with 5 additions and 5 deletions

View File

@ -42,12 +42,12 @@ def remove_duplicates(list):
return d.keys() return d.keys()
def search_person_cmd(search_strings, search_description=False): def search_person_cmd(search_strings, search_description=False):
people = search_people(search_strings, search_description) people = search_person(search_strings, search_description)
format = '%-30s %-10s %-60s' format = '%-20s %-10s %-70s'
for person in people: for person in people:
name = cut_str(person.first_name+' '+person.last_name, 30) name = cut_str(person.first_name+' '+person.last_name, 20)
p_id = cut_str(person.id, 10) p_id = cut_str(person.id, 10)
books = cut_str(', '.join(map(lambda x: x.book.title, person.books.all()))) books = cut_str(', '.join(map(lambda x: x.book.title, person.books.all())), 70)
print format % (name,p_id,books) print format % (name,p_id,books)
def search_person(search_strings, search_description=False): def search_person(search_strings, search_description=False):
@ -81,7 +81,7 @@ commands = { 'show':
'search-person': 'search-person':
{ 'args': [('search_strings', (1,None))], { 'args': [('search_strings', (1,None))],
'options': [], 'options': [],
'fun': search_person }, 'fun': search_person_cmd },
'commit': 'commit':
{ 'args': [('filename', (0,1))], { 'args': [('filename', (0,1))],
'options': [], 'options': [],