From d79122f40ba2016b1a943e2e1ba46984b2ef99ad Mon Sep 17 00:00:00 2001 From: Tim Graham Date: Mon, 17 Aug 2015 11:07:03 -0400 Subject: [PATCH] Refs #23276 -- Removed passing views as strings to url() per deprecation timeline. --- django/conf/urls/__init__.py | 17 ++--------------- docs/ref/urls.txt | 15 +-------------- 2 files changed, 3 insertions(+), 29 deletions(-) diff --git a/django/conf/urls/__init__.py b/django/conf/urls/__init__.py index d63dbe92138..f9cd305ece0 100644 --- a/django/conf/urls/__init__.py +++ b/django/conf/urls/__init__.py @@ -6,9 +6,7 @@ from django.core.urlresolvers import ( LocaleRegexURLResolver, RegexURLPattern, RegexURLResolver, ) from django.utils import six -from django.utils.deprecation import ( - RemovedInDjango20Warning, RemovedInDjango110Warning, -) +from django.utils.deprecation import RemovedInDjango20Warning __all__ = ['handler400', 'handler403', 'handler404', 'handler500', 'include', 'url'] @@ -76,21 +74,10 @@ def include(arg, namespace=None, app_name=None): return (urlconf_module, app_name, namespace) -def url(regex, view, kwargs=None, name=None, prefix=''): +def url(regex, view, kwargs=None, name=None): if isinstance(view, (list, tuple)): # For include(...) processing. urlconf_module, app_name, namespace = view return RegexURLResolver(regex, urlconf_module, kwargs, app_name=app_name, namespace=namespace) else: - if isinstance(view, six.string_types): - warnings.warn( - 'Support for string view arguments to url() is deprecated and ' - 'will be removed in Django 1.10 (got %s). Pass the callable ' - 'instead.' % view, - RemovedInDjango110Warning, stacklevel=2 - ) - if not view: - raise ImproperlyConfigured('Empty URL pattern view name not permitted (for pattern %r)' % regex) - if prefix: - view = prefix + '.' + view return RegexURLPattern(regex, view, kwargs, name) diff --git a/docs/ref/urls.txt b/docs/ref/urls.txt index 2b40c9eaf67..b1053c6f716 100644 --- a/docs/ref/urls.txt +++ b/docs/ref/urls.txt @@ -26,7 +26,7 @@ Helper function to return a URL pattern for serving files in debug mode:: url() ----- -.. function:: url(regex, view, kwargs=None, name=None, prefix='') +.. function:: url(regex, view, kwargs=None, name=None) ``urlpatterns`` should be a list of ``url()`` instances. For example:: @@ -35,25 +35,12 @@ url() ... ] -This function takes five arguments, most of which are optional:: - - url(regex, view, kwargs=None, name=None, prefix='') - The ``kwargs`` parameter allows you to pass additional arguments to the view function or method. See :ref:`views-extra-options` for an example. See :ref:`Naming URL patterns ` for why the ``name`` parameter is useful. -.. deprecated:: 1.8 - - Support for string ``view`` arguments is deprecated and will be removed in - Django 1.10. Pass the callable instead. - - The ``prefix`` parameter has the same meaning as the first argument to - ``patterns()`` and is only relevant when you're passing a string as the - ``view`` parameter. - include() ---------