Fixed #10904 -- Corrected inappropriate usage of the term "absolute URL" throughout the docs. Replaced with the (RFC 2396-compliant) terms "absolute path reference" or "absolute path" as appropriate for the context. Thanks to sharan666 for the report, and Malcolm, Chris, and dwillis for their work in supplying a solution and patch.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@14482 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
Gabriel Hurley 2010-11-07 01:42:55 +00:00
parent 1a878f30b0
commit 7f2b36050e
8 changed files with 23 additions and 21 deletions

View File

@ -63,7 +63,7 @@ Using a :class:`~django.db.models.FileField` or an
(relative to :setting:`MEDIA_ROOT`). You'll most likely want to use the (relative to :setting:`MEDIA_ROOT`). You'll most likely want to use the
convenience :attr:`~django.core.files.File.url` attribute provided by convenience :attr:`~django.core.files.File.url` attribute provided by
Django. For example, if your :class:`~django.db.models.ImageField` is Django. For example, if your :class:`~django.db.models.ImageField` is
called ``mug_shot``, you can get the absolute URL to your image in a called ``mug_shot``, you can get the absolute path to your image in a
template with ``{{ object.mug_shot.url }}``. template with ``{{ object.mug_shot.url }}``.
How do I make a variable available to all my templates? How do I make a variable available to all my templates?

View File

@ -538,9 +538,9 @@ this::
The idea behind :func:`~django.conf.urls.defaults.include` and URLconf The idea behind :func:`~django.conf.urls.defaults.include` and URLconf
decoupling is to make it easy to plug-and-play URLs. Now that polls are in their decoupling is to make it easy to plug-and-play URLs. Now that polls are in their
own URLconf, they can be placed under "/polls/", or under "/fun_polls/", or own URLconf, they can be placed under "/polls/", or under "/fun_polls/", or
under "/content/polls/", or any other URL root, and the app will still work. under "/content/polls/", or any other path root, and the app will still work.
All the poll app cares about is its relative URLs, not its absolute URLs. All the poll app cares about is its relative path, not its absolute path.
When you're comfortable with writing views, read :doc:`part 4 of this tutorial When you're comfortable with writing views, read :doc:`part 4 of this tutorial
</intro/tutorial04>` to learn about simple form processing and generic views. </intro/tutorial04>` to learn about simple form processing and generic views.

View File

@ -143,21 +143,22 @@ Sitemap class reference
**Optional.** Either a method or attribute. **Optional.** Either a method or attribute.
If it's a method, it should return the absolute URL for a given object as If it's a method, it should return the absolute path for a given object
returned by :attr:`~Sitemap.items()`. as returned by :attr:`~Sitemap.items()`.
If it's an attribute, its value should be a string representing an absolute URL If it's an attribute, its value should be a string representing an
to use for *every* object returned by :attr:`~Sitemap.items()`. absolute path to use for *every* object returned by
:attr:`~Sitemap.items()`.
In both cases, "absolute URL" means a URL that doesn't include the protocol or In both cases, "absolute path" means a URL that doesn't include the
domain. Examples: protocol or domain. Examples:
* Good: :file:`'/foo/bar/'` * Good: :file:`'/foo/bar/'`
* Bad: :file:`'example.com/foo/bar/'` * Bad: :file:`'example.com/foo/bar/'`
* Bad: :file:`'http://example.com/foo/bar/'` * Bad: :file:`'http://example.com/foo/bar/'`
If :attr:`~Sitemap.location` isn't provided, the framework will call the If :attr:`~Sitemap.location` isn't provided, the framework will call
``get_absolute_url()`` method on each object as returned by the ``get_absolute_url()`` method on each object as returned by
:attr:`~Sitemap.items()`. :attr:`~Sitemap.items()`.
.. attribute:: Sitemap.lastmod .. attribute:: Sitemap.lastmod
@ -300,7 +301,7 @@ that: :func:`django.contrib.sitemaps.ping_google()`.
.. function:: ping_google .. function:: ping_google
:func:`ping_google` takes an optional argument, :data:`sitemap_url`, :func:`ping_google` takes an optional argument, :data:`sitemap_url`,
which should be the absolute URL of your site's sitemap (e.g., which should be the absolute path to your site's sitemap (e.g.,
:file:`'/sitemap.xml'`). If this argument isn't provided, :file:`'/sitemap.xml'`). If this argument isn't provided,
:func:`ping_google` will attempt to figure out your :func:`ping_google` will attempt to figure out your
sitemap by performing a reverse looking in your URLconf. sitemap by performing a reverse looking in your URLconf.

View File

@ -274,7 +274,7 @@ comes directly from your :setting:`LANGUAGE_CODE` setting.
URLs URLs
---- ----
The :attr:`link` method/attribute can return either an absolute URL (e.g. The :attr:`link` method/attribute can return either an absolute path (e.g.
:file:`"/blog/"`) or a URL with the fully-qualified domain and protocol (e.g. :file:`"/blog/"`) or a URL with the fully-qualified domain and protocol (e.g.
``"http://www.example.com/blog/"``). If :attr:`link` doesn't return the domain, ``"http://www.example.com/blog/"``). If :attr:`link` doesn't return the domain,
the syndication framework will insert the domain of the current site, according the syndication framework will insert the domain of the current site, according

View File

@ -539,7 +539,7 @@ takes a few steps:
(relative to :setting:`MEDIA_ROOT`). You'll most likely want to use the (relative to :setting:`MEDIA_ROOT`). You'll most likely want to use the
convenience :attr:`~django.core.files.File.url` function provided by convenience :attr:`~django.core.files.File.url` function provided by
Django. For example, if your :class:`ImageField` is called ``mug_shot``, Django. For example, if your :class:`ImageField` is called ``mug_shot``,
you can get the absolute URL to your image in a template with you can get the absolute path to your image in a template with
``{{ object.mug_shot.url }}``. ``{{ object.mug_shot.url }}``.
For example, say your :setting:`MEDIA_ROOT` is set to ``'/home/media'``, and For example, say your :setting:`MEDIA_ROOT` is set to ``'/home/media'``, and

View File

@ -491,7 +491,7 @@ Similarly, if you had a URLconf entry that looked like::
Notice that we specify an empty sequence for the second parameter in this case, Notice that we specify an empty sequence for the second parameter in this case,
because we only want to pass keyword parameters, not positional ones. because we only want to pass keyword parameters, not positional ones.
In this way, you're tying the model's absolute URL to the view that is used In this way, you're tying the model's absolute path to the view that is used
to display it, without repeating the URL information anywhere. You can still to display it, without repeating the URL information anywhere. You can still
use the ``get_absolute_url`` method in templates, as before. use the ``get_absolute_url`` method in templates, as before.

View File

@ -605,9 +605,9 @@ types of HTTP responses. Like ``HttpResponse``, these subclasses live in
.. class:: HttpResponseRedirect .. class:: HttpResponseRedirect
The constructor takes a single argument -- the path to redirect to. This The constructor takes a single argument -- the path to redirect to. This
can be a fully qualified URL (e.g. ``'http://www.yahoo.com/search/'``) or an can be a fully qualified URL (e.g. ``'http://www.yahoo.com/search/'``) or
absolute URL with no domain (e.g. ``'/search/'``). Note that this returns an absolute path with no domain (e.g. ``'/search/'``). Note that this
an HTTP status code 302. returns an HTTP status code 302.
.. class:: HttpResponsePermanentRedirect .. class:: HttpResponsePermanentRedirect

View File

@ -868,9 +868,10 @@ The argument tells which template bit to output:
url url
~~~ ~~~
Returns an absolute URL (i.e., a URL without the domain name) matching a given Returns an absolute path reference (a URL without the domain name) matching a
view function and optional parameters. This is a way to output links without given view function and optional parameters. This is a way to output links
violating the DRY principle by having to hard-code URLs in your templates:: without violating the DRY principle by having to hard-code URLs in your
templates::
{% url path.to.some_view v1 v2 %} {% url path.to.some_view v1 v2 %}