Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Fixes #14743 - Add sphinx links and other cleanups to topics/http/url…

…s.txt. Thanks adamv for the patch.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@14705 bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information...
commit ba21814583e5e3a4fafc4f5f34a26b6acdfb7590 1 parent 044d5a2
Tim Graham authored November 26, 2010

Showing 1 changed file with 22 additions and 22 deletions. Show diff stats Hide diff stats

  1. 44  docs/topics/http/urls.txt
44  docs/topics/http/urls.txt
@@ -37,14 +37,14 @@ When a user requests a page from your Django-powered site, this is the
37 37
 algorithm the system follows to determine which Python code to execute:
38 38
 
39 39
     1. Django determines the root URLconf module to use. Ordinarily,
40  
-       this is the value of the ``ROOT_URLCONF`` setting, but if the incoming
  40
+       this is the value of the :setting:`ROOT_URLCONF` setting, but if the incoming
41 41
        ``HttpRequest`` object has an attribute called ``urlconf`` (set by
42 42
        middleware :ref:`request processing <request-middleware>`), its value
43  
-       will be used in place of the ``ROOT_URLCONF`` setting.
  43
+       will be used in place of the :setting:`ROOT_URLCONF` setting.
44 44
 
45 45
     2. Django loads that Python module and looks for the variable
46 46
        ``urlpatterns``. This should be a Python list, in the format returned by
47  
-       the function ``django.conf.urls.defaults.patterns()``.
  47
+       the function :func:`django.conf.urls.defaults.patterns`.
48 48
 
49 49
     3. Django runs through each URL pattern, in order, and stops at the first
50 50
        one that matches the requested URL.
@@ -174,12 +174,14 @@ Syntax of the urlpatterns variable
174 174
 ==================================
175 175
 
176 176
 ``urlpatterns`` should be a Python list, in the format returned by the function
177  
-``django.conf.urls.defaults.patterns()``. Always use ``patterns()`` to create
  177
+:func:`django.conf.urls.defaults.patterns`. Always use ``patterns()`` to create
178 178
 the ``urlpatterns`` variable.
179 179
 
180 180
 Convention is to use ``from django.conf.urls.defaults import *`` at the top of
181 181
 your URLconf. This gives your module access to these objects:
182 182
 
  183
+.. module:: django.conf.urls.defaults
  184
+
183 185
 patterns
184 186
 --------
185 187
 
@@ -436,10 +438,11 @@ directly the pattern list as returned by `patterns`_ instead. For example::
436 438
 
437 439
 This approach can be seen in use when you deploy an instance of the Django
438 440
 Admin application. The Django Admin is deployed as instances of a
439  
-:class:`AdminSite`; each :class:`AdminSite` instance has an attribute
440  
-``urls`` that returns the url patterns available to that instance. It is this
441  
-attribute that you ``include()`` into your projects ``urlpatterns`` when you
442  
-deploy the admin instance.
  441
+:class:`~django.contrib.admin.AdminSite`; each
  442
+:class:`~django.contrib.admin.AdminSite` instance has an attribute ``urls``
  443
+that returns the url patterns available to that instance. It is this attribute
  444
+that you ``include()`` into your projects ``urlpatterns`` when you deploy the
  445
+admin instance.
443 446
 
444 447
 .. _`Django Web site`: http://www.djangoproject.com/
445 448
 
@@ -507,9 +510,9 @@ a 3-tuple containing::
507 510
 
508 511
 This will include the nominated URL patterns into the given application and
509 512
 instance namespace. For example, the ``urls`` attribute of Django's
510  
-:class:`AdminSite` object returns a 3-tuple that contains all the patterns in
511  
-an admin site, plus the name of the admin instance, and the application
512  
-namespace ``admin``.
  513
+:class:`~django.contrib.admin.AdminSite` object returns a 3-tuple that contains
  514
+all the patterns in an admin site, plus the name of the admin instance, and the
  515
+application namespace ``admin``.
513 516
 
514 517
 Once you have defined namespaced URLs, you can reverse them. For details on
515 518
 reversing namespaced urls, see the documentation on :ref:`reversing namespaced
@@ -834,13 +837,13 @@ following signature:
834 837
 ``path`` is the URL path you want to resolve. As with
835 838
 :func:`~django.core.urlresolvers.reverse`, you don't need to
836 839
 worry about the ``urlconf`` parameter. The function returns a
837  
-:class:`django.core.urlresolvers.ResolverMatch` object that allows you
  840
+:class:`ResolverMatch` object that allows you
838 841
 to access various meta-data about the resolved URL.
839 842
 
840 843
 If the URL does not resolve, the function raises an
841 844
 :class:`~django.http.Http404` exception.
842 845
 
843  
-.. class:: ResolverMatch()
  846
+.. class:: ResolverMatch
844 847
 
845 848
     .. attribute:: ResolverMatch.func
846 849
 
@@ -875,19 +878,17 @@ If the URL does not resolve, the function raises an
875 878
         The list of individual namespace components in the full
876 879
         instance namespace for the URL pattern that matches the URL.
877 880
         i.e., if the namespace is ``foo:bar``, then namespaces will be
878  
-        ``[`foo`, `bar`]``.
  881
+        ``['foo', 'bar']``.
879 882
 
880  
-A :class:`~django.core.urlresolvers.ResolverMatch` object can then be
881  
-interrogated to provide information about the URL pattern that matches
882  
-a URL::
  883
+A :class:`ResolverMatch` object can then be interrogated to provide
  884
+information about the URL pattern that matches a URL::
883 885
 
884 886
     # Resolve a URL
885 887
     match = resolve('/some/path/')
886 888
     # Print the URL pattern that matches the URL
887 889
     print match.url_name
888 890
 
889  
-A :class:`~django.core.urlresolvers.ResolverMatch` object can also be
890  
-assigned to a triple::
  891
+A :class:`ResolverMatch` object can also be assigned to a triple::
891 892
 
892 893
     func, args, kwargs = resolve('/some/path/')
893 894
 
@@ -895,9 +896,8 @@ assigned to a triple::
895 896
     Triple-assignment exists for backwards-compatibility. Prior to
896 897
     Django 1.3, :func:`~django.core.urlresolvers.resolve` returned a
897 898
     triple containing (view function, arguments, keyword arguments);
898  
-    the :class:`~django.core.urlresolvers.ResolverMatch` object (as
899  
-    well as the namespace and pattern information it provides) is not
900  
-    available in earlier Django releases.
  899
+    the :class:`ResolverMatch` object (as well as the namespace and pattern
  900
+    information it provides) is not available in earlier Django releases.
901 901
 
902 902
 One possible use of :func:`~django.core.urlresolvers.resolve` would be
903 903
 to testing if a view would raise a ``Http404`` error before

0 notes on commit ba21814

Please sign in to comment.
Something went wrong with that request. Please try again.