Author: mtredinnick
Date: 2008-12-09 01:35:34 -0600 (Tue, 09 Dec 2008)
New Revision: 9627
Modified:
django/branches/releases/1.0.X/docs/ref/generic-views.txt
Log:
[1.0.X] Documented how to handle '%' characters in redirect_to() URL strings
(even in the absence of keyword arguments). Fixed #9773.
Backport of r9626 from trunk.
Modified: django/branches/releases/1.0.X/docs/ref/generic-views.txt
===================================================================
--- django/branches/releases/1.0.X/docs/ref/generic-views.txt 2008-12-09
07:33:08 UTC (rev 9626)
+++ django/branches/releases/1.0.X/docs/ref/generic-views.txt 2008-12-09
07:35:34 UTC (rev 9627)
@@ -120,7 +120,10 @@
Redirects to a given URL.
The given URL may contain dictionary-style string formatting, which will be
-interpolated against the parameters captured in the URL.
+interpolated against the parameters captured in the URL. Because keyword
+interpolation is *always* done (even if no arguments are passed in), any
``"%"``
+characters in the URL must be written as ``"%%"`` so that Python will convert
+them to a single percent sign on output.
If the given URL is ``None``, Django will return an ``HttpResponseGone`` (410).
@@ -143,6 +146,14 @@
('^bar/$', 'redirect_to', {'url': None}),
)
+This example shows how ``"%"`` characters must be written in the URL in order
+to avoid confusion with Python's string formatting markers. If the redirect
+string is written as ``"%7Ejacob/"`` (with only a single ``%``), an exception
would be raised::
+
+ urlpatterns = patterns('django.views.generic.simple',
+ ('^bar/$', 'redirect_to', {'url': '%%7Ejacob.'}),
+ )
+
Date-based generic views
========================
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/django-updates?hl=en
-~----------~----~----~----~------~----~------~--~---