diff options
Diffstat (limited to 'djangorestframework/resource.py')
| -rw-r--r-- | djangorestframework/resource.py | 5 |
1 files changed, 1 insertions, 4 deletions
diff --git a/djangorestframework/resource.py b/djangorestframework/resource.py index fdbce8b5..636fe0ba 100644 --- a/djangorestframework/resource.py +++ b/djangorestframework/resource.py @@ -54,7 +54,7 @@ class Resource(RequestMixin, ResponseMixin, AuthMixin, View): @property def allowed_methods(self): - return [method.upper() for method in self.http_method_names if getattr(self, method, None)] + return [method.upper() for method in self.http_method_names if hasattr(self, method)] def http_method_not_allowed(self, request, *args, **kwargs): """Return an HTTP 405 error if an operation is called which does not have a handler method.""" @@ -97,9 +97,6 @@ class Resource(RequestMixin, ResponseMixin, AuthMixin, View): # Get the appropriate handler method if self.method.lower() in self.http_method_names: handler = getattr(self, self.method.lower(), self.http_method_not_allowed) - # If a previously defined method has been disabled - if handler is None: - handler = self.http_method_not_allowed else: handler = self.http_method_not_allowed |
