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

begynt på worblehat show, må nå skrive printfunksjoner for forfattere og bøker

This commit is contained in:
Øyvind Almelid 2010-09-29 20:21:52 +00:00
parent 72ef23de26
commit e9e508d1eb
1 changed files with 18 additions and 1 deletions

View File

@ -11,7 +11,24 @@ import sys
import search
def show_book_or_person(ids, commit_format=False, tmp_file=False):
pass
for id in ids:
object = get_book_or_person(id)
print object
def get_book_or_person(id):
if id.isdigit():
return get_in_order([Book,Person],id)
else:
return get_in_order([Person,Book],id)
def get_in_order(list, id):
for object in list:
try:
b = object.objects.get(pk=id)
return b
except object.DoesNotExist:
pass
return None
def search_book_cmd(search_strings, search_description=False):
books = search_book(search_strings, search_description)