Often it's useful to generate a URL based on a path, a dict of existing query params, and new query params. update_params() does not facilitate this: it expects a URL with a query string and keyword params. This requires the caller to take multiple steps if he has a path, a dict, and new params. Change the function to:
update_params(url, params=None, debug=False, **kwparams) }}}
(Note that the meaning of the 'params' argument changes!)
'params' may be a (WebOb) MultiDict, and the values in 'kwparams may also be mutliple (i.e., lists). To preserve these, if 'params' is specified, make a copy of it, setdefault any parameters specified in the URL (to set them only if they don't exist in 'params'), and then set any params specified in kwparams. If a value exists in kwparams, it should completely replace the value in params, and multiple new values should all be added. If any kwparam has a None value, delete the key in params if it exists.
Alternatively, if params is specified and the URL also has params, ignore the URL's params. It's not likely that both would be specified, and the dict should be more definitive.
If params is not specified, it would be fine to keep the existing implementation rather than rewrite it.