Handle malformed HTTP Accept values

Some clients cause tastypie to return a 500 error because they send a request
with an HTTP Accept header which contains an invalid MIME type (e.g. any value
without a "/" other than "*", which mimeparse handles).

determine_format() now raises BadRequest any time mimeparse fails.
Resources now handle this by returning HTTP 400 immediately rather than
the normal error response
wrap_view: handle BadRequest exceptions gracefully
PEP-8: replace legacy has_key() with ``foo in bar``