From 3034d0a919df9fc80b9b9e72c17fadfab957c46e Mon Sep 17 00:00:00 2001 From: Billy Ferguson Date: Thu, 10 Oct 2019 15:18:46 -0400 Subject: [PATCH] Moves http_method_names out to shared scope. --- rest_framework/schemas/generators.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rest_framework/schemas/generators.py b/rest_framework/schemas/generators.py index e1f33780b..00d33a89a 100644 --- a/rest_framework/schemas/generators.py +++ b/rest_framework/schemas/generators.py @@ -133,9 +133,9 @@ class EndpointEnumerator: """ Return a list of the valid HTTP methods for this endpoint. """ + http_method_names = set(callback.cls.http_method_names) if hasattr(callback, 'actions'): actions = set(callback.actions) - http_method_names = set(callback.cls.http_method_names) methods = [method.upper() for method in actions & http_method_names] else: methods = [method.upper() for method in callback.cls().allowed_methods & http_method_names]