handle invalid search terms

This commit is contained in:
Alex Vidal 2011-02-22 11:37:29 -06:00
parent 450c681fab
commit 746146edb4
1 changed files with 4 additions and 0 deletions

View File

@ -73,6 +73,10 @@ def metacritic(inp):
if not doc.find_class('query_results'):
return 'no results found'
# if they specified an invalid search term, the input box will be empty
if doc.get_element_by_id('search_term').value == '':
return 'invalid search term'
if plat not in game_platforms:
# for [all] results, or non-game platforms, get the first result
result = doc.find_class('result first_result')[0]