Ticket #10328: 10328.diff

File 10328.diff, 2.8 KB (added by Tim Graham, 14 years ago)

combining existing diffs into a single patch + minor edits

  • docs/topics/http/urls.txt

     
    858858The :func:`django.db.models.permalink` decorator is useful for writing short
    859859methods that return a full URL path. For example, a model's
    860860``get_absolute_url()`` method. See :func:`django.db.models.permalink` for more.
     861
     862get_script_prefix()
     863-------------------
     864
     865.. function:: get_script_prefix()
     866
     867.. versionadded:: 1.0
     868
     869Normally, you should always use :func:`~django.core.urlresolvers.reverse` or
     870:func:`~django.db.models.permalink` to define URLs within your application.
     871However, if your application constructs part of the URL hierarchy itself, you
     872may occasionally need to generate URLs. In that case, you need to be able to
     873find the base URL of the Django project within its web server
     874(normally, :func:`~django.core.urlresolvers.reverse` takes care of this for
     875you). In that case, you can call ``get_script_prefix()``, which will return the
     876script prefix portion of the URL for your Django project. If your Django
     877project is at the root of its webserver, this is always ``"/"``, but it can be
     878changed, for instance  by using ``django.root`` (see :ref:`How to use
     879Django with Apache and mod_python <howto-deployment-modpython>`).
  • docs/ref/request-response.txt

     
    3232
    3333.. attribute:: HttpRequest.path
    3434
    35    A string representing the full path to the requested page, not including
    36    the domain.
     35    A string representing the full path to the requested page, not including
     36    the domain.
    3737
    38    Example: ``"/music/bands/the_beatles/"``
     38    Example: ``"/music/bands/the_beatles/"``
    3939
     40.. attribute:: HttpRequest.path_info
     41
     42    Under some web server configurations, the portion of the URL after the host
     43    name is split up into a script prefix portion and a path info portion
     44    (this happens, for example, when using the ``django.root`` option
     45    with the :ref:`modpython handler from Apache <howto-deployment-modpython>`).
     46    The ``path_info`` attribute always contains the path info portion of the
     47    path, no matter what web server is being used. Using this instead of
     48    attr:`~HttpRequest.path` can make your code much easier to move between test
     49    and deployment servers.
     50
     51    For example, if the ``django.root`` for your application is set to
     52    ``"/minfo"``, then ``path`` might be ``"/minfo/music/bands/the_beatles/"``
     53    and ``path_info`` would be ``"/music/bands/the_beatles/"``.
     54
    4055.. attribute:: HttpRequest.method
    4156
    4257    A string representing the HTTP method used in the request. This is
Back to Top