On Wed, Dec 8, 2010 at 11:02 PM, Mike Orr <[email protected]> wrote:
> On Wed, Dec 8, 2010 at 10:23 PM, Jonathan Gardner
> <[email protected]> wrote:
>> I sometimes use Route's url() to do the query args for me. For instance,
>>
>>  url('http://google.com', q='aasdf')
>>
>> will give me:
>>
>>  http://google.com?q=aasdf
>>
>> which is  a very useful shortcut.
>>
>> However, I've found that this doesn't work:
>>
>>  url('http://google.com?q=aasdf', foo='bar')
>>
>> which gives me:
>>
>>  http://google.com?q=aasdf?foo=bar
>>
>> Does it make sense to modify Routes to parse the query before it
>> applies the args in this special case? I can submit a patch.
>
> Use ``webhelpers.util.update_params()`` to add/modify query parameters on a 
> URL:
>
> update_params("http://google.com/?q=aasdf";, foo="bar")
> update_params("http://google.com/";, q="aasdf", foo="bar")
>

Thanks. Worked like a charm.

One minor issue: update_params returns unicode. Is this significant?

-- 
Jonathan Gardner
[email protected]

-- 
You received this message because you are subscribed to the Google Groups 
"pylons-discuss" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/pylons-discuss?hl=en.

Reply via email to