Fix bare except statements

This commit is contained in:
Ryan P Kilby 2017-11-25 21:06:13 -05:00
parent eb61eb2b86
commit 7b58a2c124
2 changed files with 2 additions and 2 deletions

View File

@ -260,7 +260,7 @@ class AutoSchema(ViewInspector):
# Attempt to infer a field description if possible. # Attempt to infer a field description if possible.
try: try:
model_field = model._meta.get_field(variable) model_field = model._meta.get_field(variable)
except: except Exception:
model_field = None model_field = None
if model_field is not None and model_field.verbose_name: if model_field is not None and model_field.verbose_name:

View File

@ -61,7 +61,7 @@ class JSONEncoder(json.JSONEncoder):
elif hasattr(obj, '__getitem__'): elif hasattr(obj, '__getitem__'):
try: try:
return dict(obj) return dict(obj)
except: except Exception:
pass pass
elif hasattr(obj, '__iter__'): elif hasattr(obj, '__iter__'):
return tuple(item for item in obj) return tuple(item for item in obj)