Skip to content
This repository has been archived by the owner on Jan 11, 2021. It is now read-only.

Commit

Permalink
Merge branch 'feature/fix-deprecation-warning'
Browse files Browse the repository at this point in the history
  • Loading branch information
marcgibbons committed Jul 20, 2016
2 parents 706bafc + 47b40b2 commit 953039e
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 10 deletions.
7 changes: 7 additions & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -1,2 +1,9 @@
include README.md
include LICENSE

global-exclude __pycache__
global-exclude *.pyc
global-exclude *.pyo

recursive-include rest_framework_swagger/static *
recursive-include rest_framework_swagger/templates *
19 changes: 9 additions & 10 deletions rest_framework_swagger/renderers.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
from coreapi.compat import force_bytes
from django.conf import settings
from django.shortcuts import resolve_url
from django.template import loader, RequestContext
from django.shortcuts import render, resolve_url
from openapi_codec import OpenAPICodec
from rest_framework.renderers import BaseRenderer
import simplejson as json
Expand Down Expand Up @@ -31,18 +30,18 @@ class SwaggerUIRenderer(BaseRenderer):
charset = 'utf-8'

def render(self, data, accepted_media_type=None, renderer_context=None):
context = self.get_context(renderer_context)
template = loader.get_template(self.template)

return template.render(context)

def get_context(self, renderer_context):
self.set_context(renderer_context)
return render(
renderer_context['request'],
self.template,
renderer_context
)

def set_context(self, renderer_context):
renderer_context['USE_SESSION_AUTH'] = \
swagger_settings.USE_SESSION_AUTH
self.set_session_auth_urls(renderer_context)

return RequestContext(renderer_context['request'], renderer_context)

def set_session_auth_urls(self, renderer_context):
path = renderer_context['request'].path
urls = {
Expand Down

0 comments on commit 953039e

Please sign in to comment.