Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Fixed #3664 -- Documented that get_absolute_url() and item_link() (in

syndication) links are expected to be strings that can be used in URLs without
further quoting or encoding.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@5250 bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information...
commit 7969c1bb655d24f98e8653d9008c90c6b0280673 1 parent a10e73a
Malcolm Tredinnick authored May 15, 2007
9  docs/model-api.txt
@@ -1759,6 +1759,15 @@ But this template code is good::
1759 1759
 
1760 1760
     <a href="{{ object.get_absolute_url }}">{{ object.name }}</a>
1761 1761
 
  1762
+.. note::
  1763
+    The string you return from ``get_absolute_url()`` must be use only ASCII
  1764
+    characters (required by the URI spec, `RFC 2396`_) that has been
  1765
+    URL-encoded, if necessary. Code and templates using ``get_absolute_url()``
  1766
+    should be able to use the result directly without needing to do any
  1767
+    further processing.
  1768
+
  1769
+.. _RFC 2396: http://www.ietf.org/rfc/rfc2396.txt
  1770
+
1762 1771
 The ``permalink`` decorator
1763 1772
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~
1764 1773
 
5  docs/syndication_feeds.txt
@@ -146,7 +146,10 @@ put into those elements.
146 146
       exist, it tries calling a method ``item_link()`` in the ``Feed`` class,
147 147
       passing it a single parameter, ``item``, which is the object itself.
148 148
       Both ``get_absolute_url()`` and ``item_link()`` should return the item's
149  
-      URL as a normal Python string.
  149
+      URL as a normal Python string. As with ``get_absolute_url()``, the
  150
+      result of ``item_link()`` will be included directly in the URL, so you
  151
+      are responsible for doing all necessary URL quoting and conversion to
  152
+      ASCII inside the method itself.
150 153
 
151 154
     * For the LatestEntries example above, we could have very simple feed templates:
152 155
 

0 notes on commit 7969c1b

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