mirror of
https://github.com/encode/django-rest-framework.git
synced 2024-11-22 17:47:04 +03:00
Fix bare except statements
This commit is contained in:
parent
eb61eb2b86
commit
7b58a2c124
|
@ -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:
|
||||||
|
|
|
@ -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)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user