Es bad url

Bug: http://manage.dimagi.com/default.asp?126923
Searched for and changed the occurrences of run_query where we were checking for None. In commit: 7b5fb6ff39158beb8c1e381a7decc28d0d8c62aa