Refactor CBV schema method limitation for set operations

This commit is contained in:
hurturk 2017-05-02 17:34:53 -04:00
parent 2196cd2bbb
commit 6075f8051a

View File

@ -246,10 +246,9 @@ class EndpointInspector(object):
Return a list of the valid HTTP methods for this endpoint. Return a list of the valid HTTP methods for this endpoint.
""" """
if hasattr(callback, 'actions'): if hasattr(callback, 'actions'):
return [ actions = set(callback.actions.keys())
method.upper() for method in http_method_names = set(callback.cls().http_method_names)
set(callback.actions.keys()).intersection(set(callback.cls().http_method_names)) return [method.upper() for method in actions & http_method_names]
]
return [ return [
method for method in method for method in