scrapy/w3lib — pull request #21 by kmike (2014-05-08 16:19:45+00:00)
Title: Implement url.add_or_replace_parameter on top of stdlib functions

`add_or_replace_parameter` didn't work for me when an argument to replace is an encoded URL. In this PR this function is rewritten on top of stdlib functions.

This is backwards-incompatible change: `sep` and `url_is_quoted` arguments are removed. `url_is_quoted` is no longer needed (it seems stdlib handles this case itself). `sep` was useful for strings where ';' was used as a separator (this is allowed by RFC). After this change ';' as a separator is still supported, but the output always contains ampersands.

There may be cases for which `add_or_replace_parameter` worked before but stopped working after this change, and cases where parsing is fixed. The parsing is fixed for "standard", correct URLs, but it may become broken for some quircky urls.