Skip to content

Commit

Permalink
Mask view docstring on 401 and 403 responses. Closes #3216.
Browse files Browse the repository at this point in the history
  • Loading branch information
tomchristie committed Aug 5, 2015
1 parent 6161ac7 commit 6942fa5
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions rest_framework/renderers.py
Original file line number Diff line number Diff line change
Expand Up @@ -592,7 +592,9 @@ def __init__(self):
def get_name(self, view):
return view.get_view_name()

def get_description(self, view):
def get_description(self, view, status_code):
if status_code in (status.HTTP_401_UNAUTHORIZED, status.HTTP_403_FORBIDDEN):
return ''
return view.get_view_description(html=True)

def get_breadcrumbs(self, request):
Expand Down Expand Up @@ -631,7 +633,7 @@ def get_context(self, data, accepted_media_type, renderer_context):
'view': view,
'request': request,
'response': response,
'description': self.get_description(view),
'description': self.get_description(view, response.status_code),
'name': self.get_name(view),
'version': VERSION,
'paginator': paginator,
Expand Down

0 comments on commit 6942fa5

Please sign in to comment.