[Python-ideas] Proposed addtion to urllib.parse in 3.1 (and urlparse in 2.7)

Mart Sõmermaa mrts.pydev at gmail.com
Fri Mar 27 17:16:02 CET 2009


You are definitely "missing out something". For the use case you describe,
there's already ulrjoin(). add_query_params() is for a different use case,
i.e. it *complements* urljoin().

2009/3/27 Venkatraman S <venkat83 at gmail.com>

>
> On Fri, Mar 27, 2009 at 9:30 PM, Mart Sõmermaa <mrts.pydev at gmail.com>wrote:
>
>> Why not?
>>
>> 2009/3/27 Venkatraman S <venkat83 at gmail.com>
>>
>>>
>>> On Fri, Mar 27, 2009 at 8:56 PM, Mart Sõmermaa <mrts.pydev at gmail.com>wrote:
>>>
>>>>
>>>>
>>>>     Usage:
>>>>     >>> add_query_params('http://foo.com', a='b')
>>>>     'http://foo.com?a=b'
>>>>     >>> add_query_params('http://foo.com?a=b', b='c', d='q')
>>>>     'http://foo.com?a=b&b=c&d=q'
>>>>
>>>>     The real implementation should be more strict, e.g. raise on the
>>>>     following:
>>>>     >>> add_query_params('http://foo.com?a=b', a='b')
>>>>     'http://foo.com?a=b&a=b'
>>>>
>>>
>>> Well, this is not 'generic'  - for eg. in Django sites the above would
>>> not be applicable.
>>>
>>
>
> http://foo.com?a=b <http://foo.com/?a=b>   !=  http://foo.com/a/b<http://foo.com/?a=b>
> .
> Semantically , both are same,but the framework rules are different. Not
> sure how you would this - by telling urllib that it is a 'pretty' django
> URL? (or am i missing out something?)
>
> -V-
>
>
>
> _______________________________________________
> Python-ideas mailing list
> Python-ideas at python.org
> http://mail.python.org/mailman/listinfo/python-ideas
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20090327/4dce55f7/attachment.html>


More information about the Python-ideas mailing list