Django: Ticket #19532: URL encoding error in set_script_prefixhttps://code.djangoproject.com/ticket/19532
<p>
We found this as a regression bug when we switched to using django 1.5.
</p>
<p>
We were generating a fully qualified url to be used as a link within an email, by doing
</p>
<pre class="wiki">set_script_prefix('http://%s' % self.domain)
</pre><p>
The url with this prefix was generated fine with django 1.4.3, but with 1.5, the url was turned into 'http%3A<em>...'
</em></p>
en-usDjangohttps://www.djangoproject.com/s/img/site/hdr_logo.gifhttps://code.djangoproject.com/ticket/19532
Trac 1.2Aymeric AugustinFri, 28 Dec 2012 22:31:09 GMTtype, severity, description changedhttps://code.djangoproject.com/ticket/19532#comment:1
https://code.djangoproject.com/ticket/19532#comment:1
<ul>
<li><strong>type</strong>
changed from <em>Uncategorized</em> to <em>Bug</em>
</li>
<li><strong>severity</strong>
changed from <em>Normal</em> to <em>Release blocker</em>
</li>
<li><strong>description</strong>
modified (<a href="/ticket/19532?action=diff&amp;version=1">diff</a>)
</li>
</ul>
<p>
Clearly, this isn't the intended use of <code>set_script_prefix</code>.
</p>
<p>
However, we should find out which commit introduced this change and ensure that it was done for a good reason (rather than by accident).
</p>
TicketClaude ParozSat, 29 Dec 2012 09:19:32 GMThttps://code.djangoproject.com/ticket/19532#comment:2
https://code.djangoproject.com/ticket/19532#comment:2
<p>
I suppose that this behaviour was introduced in the commit <a class="changeset" href="https://code.djangoproject.com/changeset/90e530978d590a5bd" title="Fixed #18210 -- Escaped special characters in reverse prefixes.
...">[90e530978d590a5bd]</a> that fixes <a class="closed ticket" href="https://code.djangoproject.com/ticket/18210" title="#18210: Bug: Regression and crash with any &#34;special&#34; prefix values passed to reverse() (closed: fixed)">#18210</a>.
</p>
TicketFlorian ApollonerSat, 29 Dec 2012 09:28:19 GMThttps://code.djangoproject.com/ticket/19532#comment:3
https://code.djangoproject.com/ticket/19532#comment:3
<p>
I can confirm that it was <a class="changeset" href="https://code.djangoproject.com/changeset/90e530978d590a5bdcf75525aa03f844766018b8" title="Fixed #18210 -- Escaped special characters in reverse prefixes.
...">[90e530978d590a5bdcf75525aa03f844766018b8]</a>. (Why do you have to be faster than me :/)
</p>
TicketAymeric AugustinSun, 30 Dec 2012 11:20:25 GMTstatus changed; resolution sethttps://code.djangoproject.com/ticket/19532#comment:4
https://code.djangoproject.com/ticket/19532#comment:4
<ul>
<li><strong>status</strong>
changed from <em>new</em> to <em>closed</em>
</li>
<li><strong>resolution</strong>
set to <em>invalid</em>
</li>
</ul>
<p>
<code>set_script_prefix</code> isn't documented; it's a private API, not subject to the backwards-compatibility policy.
</p>
<p>
Its behavior was changed on purpose, to fix a <a class="closed ticket" href="https://code.djangoproject.com/ticket/18210" title="#18210: Bug: Regression and crash with any &#34;special&#34; prefix values passed to reverse() (closed: fixed)">#18210</a>. This isn't a regression.
</p>
<p>
The URL resolver doesn't deal with the domain part; you have to include it separately in the template.
</p>
Ticket