If you use &lt;base href&gt; that might resolve this problem (pip looks at this, I haven&#39;t checked the setuptools code).<div><br></div><div>pip does not use the Setuptools index code, and I don&#39;t have unescaping in pip, so the implementations differ in this case.  I guess I didn&#39;t notice because in tests I didn&#39;t encounter any (meaningful) links with &amp;amp; in them.<br>

<br><div class="gmail_quote">On Tue, Jan 19, 2010 at 6:57 PM, P.J. Eby <span dir="ltr">&lt;<a href="mailto:pje@telecommunity.com">pje@telecommunity.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">

<div><div></div><div class="h5">At 10:21 PM 1/19/2010 +0100, Martin v. Löwis wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
&gt;&gt; 2. Make file paths relative (from<br>
&gt;&gt; &lt;<a href="http://pypi.python.org/packages" target="_blank">http://pypi.python.org/packages</a>&gt;<a href="http://pypi.python.org/packages" target="_blank">http://pypi.python.org/packages</a><br>
&gt;&gt; Â  to ../../packages)<br>
...<br>
&gt; Likewise, #2 should be fine as long as urlparse.urljoin produces the<br>
&gt; correct result using the retrieved-from URL as the base URL.  I stress<br>
&gt; this because some web applications treat the urls &quot;foo&quot; and &quot;foo/&quot; as if<br>
&gt; they were interchangeable, and for relative-URL purposes, they are not.<br>
&gt; So, as long as PyPI handles this correctly based on the URL that was<br>
&gt; sent by the *client* (rather than perhaps a canonical URL the client<br>
&gt; &quot;should have&quot; sent), then that will be fine.<br>
<br>
Can you please suggest an example where this could break? If the client<br>
doesn&#39;t send an absolute path, it will be incorrect HTTP, no?<br>
</blockquote>
<br></div></div>
No, what I mean is that if PyPI returns *identical* HTML for requests going to &quot;/foo&quot; and &quot;/foo/&quot;, then one of those pages will contain incorrect relative URLs.<br>
<br>
I mention this because, at least in the main web interface, going to <a href="http://pypi.python.org/pypi/setuptools" target="_blank">http://pypi.python.org/pypi/setuptools</a> and <a href="http://pypi.python.org/pypi/setuptools/" target="_blank">http://pypi.python.org/pypi/setuptools/</a> produces similar (if not identical) HTML.<br>


<br>
Currently, the relative URLs in such pages are site-absolute, i.e., &quot;/pypi/whatever&quot;, so the fact that the two pages are identical isn&#39;t a problem.  However, if you used pure relative URLs (&#39;../whatever&#39;), then one of the two pages would have incorrect relative URLs.<br>


<br>
So, all I am saying is, please make sure that the generated relative URLs are correct, based not on a canonical form of the URL, but based on whether the client asked for <a href="http://pypi.python.org/simple/setuptools" target="_blank">http://pypi.python.org/simple/setuptools</a> or <a href="http://pypi.python.org/simple/setuptools/" target="_blank">http://pypi.python.org/simple/setuptools/</a> - because if those two URLs return *identical* HTML, *one* of them will be wrong.<br>


<br>
In other words, one of those two pages must have one more &#39;../&#39; in each URL than the other one has for the same URL.  Does that make sense now?<br>
<br>
I&#39;m really just saying that the relative URLs must be correct, and reminding you (in case you&#39;re not already aware) that the current PyPI code may be relying on its use of &quot;/pypi&quot; relative URLs in order to ignore the trailing-slash issue.  And if that&#39;s the case, then there will be pages generated with *wrong* relative URLs, unless you remember to test both the &#39;/&#39;-terminated and non-&#39;/&#39;-terminated versions.  (Even if just by clicking the links in a browser.)<br>


<br>
</blockquote></div><br><br clear="all"><br>-- <br>Ian Bicking  |  <a href="http://blog.ianbicking.org">http://blog.ianbicking.org</a>  |  <a href="http://topplabs.org/civichacker">http://topplabs.org/civichacker</a><br>
</div>