Skip to content

Commit

Permalink
CHANGED: function visibility
Browse files Browse the repository at this point in the history
  • Loading branch information
Sebastian Bredehöft committed Jun 30, 2015
1 parent 44ed474 commit 82dbcb0
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
8 changes: 4 additions & 4 deletions drf_tools/exceptions.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,18 +31,18 @@ def exception_handler(exc):
if status_code == status.HTTP_500_INTERNAL_SERVER_ERROR or logger.isEnabledFor(logging.DEBUG):
logger.exception(str(exc))

return Response(__create_error_response_by_exception(exc), status=status_code, headers=headers)
return Response(create_error_response_by_exception(exc), status=status_code, headers=headers)


def __create_error_response_by_exception(exc):
def create_error_response_by_exception(exc):
if hasattr(exc, 'messages'):
messages = exc.messages
else:
messages = [str(exc)]
return __create_error_response(exc.__class__.__name__, messages)
return create_error_response(exc.__class__.__name__, messages)


def __create_error_response(error_type, messages, code=0):
def create_error_response(error_type, messages, code=0):
error = dict()
error['type'] = error_type
error['messages'] = messages
Expand Down
4 changes: 2 additions & 2 deletions drf_tools/renderers.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@ class BaseFileRenderer(OriginalBaseRenderer):
KWARGS_KEY_FILENAME = "filename"

def _add_filename_to_response(self, renderer_context):
filename = self.__get_filename(renderer_context)
filename = self._get_filename(renderer_context)
if filename:
renderer_context['response']['Content-Disposition'] = 'attachment; filename="{}"'.format(filename)

def __get_filename(self, renderer_context):
def _get_filename(self, renderer_context):
filename = renderer_context['kwargs'].get(self.KWARGS_KEY_FILENAME)
if filename and self.format and not filename.endswith('.' + self.format):
filename += "." + self.format
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

setup(
name='drf-tools',
version="0.9.1",
version="0.9.3",
url='https://github.com/seebass/drf-tools',
license='MIT',
description='Multiple extensions and test utilities for Django REST Framework 3',
Expand Down

0 comments on commit 82dbcb0

Please sign in to comment.