Skip to content

Commit 8faf63c

Browse files
authored
Merge pull request #1300 from tfranzel/attr_exp
guard against broken __dir__ impl #1296
2 parents 0c12f23 + 9f0d166 commit 8faf63c

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

drf_spectacular/drainage.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -180,11 +180,11 @@ def set_override(obj: Any, prop: str, value: Any) -> Any:
180180
def get_view_method_names(view, schema=None) -> List[str]:
181181
schema = schema or view.schema
182182
return [
183-
item for item in dir(view) if callable(getattr(view, item)) and (
183+
item for item in dir(view) if callable(getattr(view, item, None)) and (
184184
item in view.http_method_names
185185
or item in schema.method_mapping.values()
186186
or item == 'list'
187-
or hasattr(getattr(view, item), 'mapping')
187+
or hasattr(getattr(view, item, None), 'mapping')
188188
)
189189
]
190190

0 commit comments

Comments
 (0)