From af60be584b86e5e7be24e20c535337cc7d12f6b9 Mon Sep 17 00:00:00 2001 From: Minh Trang Nguyen Date: Wed, 7 Jan 2015 11:17:55 +0100 Subject: [PATCH 1/2] Fix replace mimetype to content_type - Replaced mimetype with content_type in provider/views.py so it will work in Django > 1.7 --- .gitignore | 16 ++++++++++++++++ provider/views.py | 10 +++++----- 2 files changed, 21 insertions(+), 5 deletions(-) diff --git a/.gitignore b/.gitignore index 7073810a..27a7c1f9 100644 --- a/.gitignore +++ b/.gitignore @@ -6,3 +6,19 @@ _build dist build venv + +.idea/workspace.xml + +.idea/vcs.xml + +.idea/scopes/scope_settings.xml + +.idea/modules.xml + +.idea/misc.xml + +.idea/encodings.xml + +.idea/django-oauth2-provider.iml + +.idea/.name diff --git a/provider/views.py b/provider/views.py index dd1200df..161e5721 100644 --- a/provider/views.py +++ b/provider/views.py @@ -292,13 +292,13 @@ class Redirect(OAuthView, Mixin): an error. """ - def error_response(self, error, mimetype='application/json', status=400, + def error_response(self, error, content_type='application/json', status=400, **kwargs): """ Return an error response to the client with default status code of *400* stating the error as outlined in :rfc:`5.2`. """ - return HttpResponse(json.dumps(error), mimetype=mimetype, + return HttpResponse(json.dumps(error), content_type=content_type, status=status, **kwargs) def get(self, request): @@ -457,13 +457,13 @@ def invalidate_access_token(self, access_token): """ raise NotImplementedError - def error_response(self, error, mimetype='application/json', status=400, + def error_response(self, error, content_type='application/json', status=400, **kwargs): """ Return an error response to the client with default status code of *400* stating the error as outlined in :rfc:`5.2`. """ - return HttpResponse(json.dumps(error), mimetype=mimetype, + return HttpResponse(json.dumps(error), content_type=content_type, status=status, **kwargs) def access_token_response(self, access_token): @@ -488,7 +488,7 @@ def access_token_response(self, access_token): pass return HttpResponse( - json.dumps(response_data), mimetype='application/json' + json.dumps(response_data), content_type='application/json' ) def authorization_code(self, request, data, client): From b75571be3e19647fe8e726c5fcf8ce8bf9fd7540 Mon Sep 17 00:00:00 2001 From: Minh Trang Nguyen Date: Wed, 7 Jan 2015 11:20:05 +0100 Subject: [PATCH 2/2] Update .gitignore - Update .gitignore file, add the .idea folder. This is used by PyCharm. --- .gitignore | 17 +---------------- 1 file changed, 1 insertion(+), 16 deletions(-) diff --git a/.gitignore b/.gitignore index 27a7c1f9..d27222fb 100644 --- a/.gitignore +++ b/.gitignore @@ -6,19 +6,4 @@ _build dist build venv - -.idea/workspace.xml - -.idea/vcs.xml - -.idea/scopes/scope_settings.xml - -.idea/modules.xml - -.idea/misc.xml - -.idea/encodings.xml - -.idea/django-oauth2-provider.iml - -.idea/.name +.idea