aboutsummaryrefslogtreecommitdiffstats
path: root/rest_framework/views.py
diff options
context:
space:
mode:
Diffstat (limited to 'rest_framework/views.py')
-rw-r--r--rest_framework/views.py12
1 files changed, 9 insertions, 3 deletions
diff --git a/rest_framework/views.py b/rest_framework/views.py
index c4662a1f..e8bd9f50 100644
--- a/rest_framework/views.py
+++ b/rest_framework/views.py
@@ -71,6 +71,10 @@ class APIView(View):
actions = {}
for method in self.allowed_methods:
+ # skip HEAD and OPTIONS
+ if method in ('HEAD', 'OPTIONS'):
+ continue
+
cloned_request = clone_request(request, method)
try:
self.check_permissions(cloned_request)
@@ -81,11 +85,13 @@ class APIView(View):
field_name_types = {}
for name, field in serializer.fields.iteritems():
from rest_framework.fields import humanize_field
- humanize_field(field)
- field_name_types[name] = field.__class__.__name__
+ field_name_types[name] = humanize_field(field)
actions[method] = field_name_types
- except:
+ except exceptions.PermissionDenied:
+ # don't add this method
+ pass
+ except exceptions.NotAuthenticated:
# don't add this method
pass