Skip to content

Commit b2ca2c1

Browse files
author
Carlton Gibson
authored
Remove deprecated schema code from DefaultRouter (#5482)
1 parent c674687 commit b2ca2c1

File tree

1 file changed

+1
-34
lines changed

1 file changed

+1
-34
lines changed

rest_framework/routers.py

Lines changed: 1 addition & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616
from __future__ import unicode_literals
1717

1818
import itertools
19-
import warnings
2019
from collections import OrderedDict, namedtuple
2120

2221
from django.conf.urls import url
@@ -330,41 +329,12 @@ class DefaultRouter(SimpleRouter):
330329
SchemaGenerator = SchemaGenerator
331330

332331
def __init__(self, *args, **kwargs):
333-
if 'schema_title' in kwargs:
334-
warnings.warn(
335-
"Including a schema directly via a router is now deprecated. "
336-
"Use `get_schema_view()` instead.",
337-
DeprecationWarning, stacklevel=2
338-
)
339-
if 'schema_renderers' in kwargs:
340-
assert 'schema_title' in kwargs, 'Missing "schema_title" argument.'
341-
if 'schema_url' in kwargs:
342-
assert 'schema_title' in kwargs, 'Missing "schema_title" argument.'
343-
self.schema_title = kwargs.pop('schema_title', None)
344-
self.schema_url = kwargs.pop('schema_url', None)
345-
self.schema_renderers = kwargs.pop('schema_renderers', self.default_schema_renderers)
346-
347332
if 'root_renderers' in kwargs:
348333
self.root_renderers = kwargs.pop('root_renderers')
349334
else:
350335
self.root_renderers = list(api_settings.DEFAULT_RENDERER_CLASSES)
351336
super(DefaultRouter, self).__init__(*args, **kwargs)
352337

353-
def get_schema_root_view(self, api_urls=None):
354-
"""
355-
Return a schema root view.
356-
"""
357-
schema_generator = self.SchemaGenerator(
358-
title=self.schema_title,
359-
url=self.schema_url,
360-
patterns=api_urls
361-
)
362-
363-
return self.APISchemaView.as_view(
364-
renderer_classes=self.schema_renderers,
365-
schema_generator=schema_generator,
366-
)
367-
368338
def get_api_root_view(self, api_urls=None):
369339
"""
370340
Return a basic root view.
@@ -384,10 +354,7 @@ def get_urls(self):
384354
urls = super(DefaultRouter, self).get_urls()
385355

386356
if self.include_root_view:
387-
if self.schema_title:
388-
view = self.get_schema_root_view(api_urls=urls)
389-
else:
390-
view = self.get_api_root_view(api_urls=urls)
357+
view = self.get_api_root_view(api_urls=urls)
391358
root_url = url(r'^$', view, name=self.root_view_name)
392359
urls.append(root_url)
393360

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy