Skip to content

Commit

Permalink
guard against broken __dir__ impl #1296
Browse files Browse the repository at this point in the history
  • Loading branch information
tfranzel committed Sep 25, 2024
1 parent 0c12f23 commit 9f0d166
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions drf_spectacular/drainage.py
Original file line number Diff line number Diff line change
Expand Up @@ -180,11 +180,11 @@ def set_override(obj: Any, prop: str, value: Any) -> Any:
def get_view_method_names(view, schema=None) -> List[str]:
schema = schema or view.schema
return [
item for item in dir(view) if callable(getattr(view, item)) and (
item for item in dir(view) if callable(getattr(view, item, None)) and (
item in view.http_method_names
or item in schema.method_mapping.values()
or item == 'list'
or hasattr(getattr(view, item), 'mapping')
or hasattr(getattr(view, item, None), 'mapping')
)
]

Expand Down

0 comments on commit 9f0d166

Please sign in to comment.