We've been seeing a lot of cases where search engines crawl a site and i...

...ssue requests for content which does not exist. This is a small fix to prevent spurious exceptions from being thrown in those cases.

The only change here is to wrap queries in try/except to handle conditions in which an invalid value is passed into the view.