On Jan 4, 2009, at 9:06 PM, Tycon wrote:
Another issue with url_for is the handling of query string parameters using keyword arguments. Currently any extra keyword arguments will be added to the generated URL as query string, for example:url_for('/page', arg='val') ==> /page?arg=val The problem is that you can't use keyword arguments for any of the argument names reserved by the function, such as "host", "protocol", etc, for example: params = { 'arg': 'val', 'host': 'machine' } url_for('/page', **params) should return: /page?arg=val&host=machine but it treats the "host" key in params as the host name so it actually returns:
Right, the alternative we thought of was forcing all the keyword args destined for Routes to be in a dict passed in, but that obviously makes it a little more annoying to use, though it keeps the arguments separate from the ones url_for itself uses. However, I could see having it strip off arg's with a trailing underscore for use by Routes, such that you'd be able to do:
url_for('/page', host_='machine') -> /page?host=machine
Would that work?
Cheers,
Ben
smime.p7s
Description: S/MIME cryptographic signature
