diff --git a/python/worblehat.py b/python/worblehat.py index e08d3fc..12cc566 100755 --- a/python/worblehat.py +++ b/python/worblehat.py @@ -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)