[issue1755841] Patch for [ 735515 ] urllib2 should cache 301 redir

Antoine Pitrou report at bugs.python.org
Tue Jan 5 16:54:23 CET 2010


Antoine Pitrou <pitrou at free.fr> added the comment:

Well, first it would be better with some tests.

Second, what does it do for chained redirects? E.g. let's say that there's a chain of 301 redirects: A --> B --> C. Does it cache the whole A --> C mapping, or only A --> B? If the latter, will the chaining occur when looking up the redirected url from the cache (it doesn't seem to)?

Third, it seems to use a global OpenerDirector object. Are there situations where it should rather use a request-specific object?

Fourth, you shouldn't need to define a separate http_error_301 method. Just add the `cacheable` argument to `http_error_302`. Also, the `_cache_301_redirect` attribute seems useless.

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue1755841>
_______________________________________


More information about the Python-bugs-list mailing list