Update v2.options docstring

We already support 'type' attribute for query, but the docstring for
build_url and cli_to_array don't refer to it.

And the urlencode with doseq=True will force filter parameters grouped
by name, so the sample in build_url docstring should be corrected too.

Change-Id: I2b526d9e23175b5378ea36e0a532052269c7f0c4
This commit is contained in:
ZhiQiang Fan
2014-04-15 14:41:45 +08:00
parent e56da49b60
commit b3da963826

View File

@@ -19,11 +19,14 @@ from six.moves.urllib import parse
def build_url(path, q, params=None):
'''This converts from a list of dicts and a list of params to
what the rest api needs, so from:
"[{field=this,op=le,value=34},{field=that,op=eq,value=foo}],
"[{field=this,op=le,value=34},
{field=that,op=eq,value=foo,type=string}],
['foo=bar','sna=fu']"
to:
"?q.field=this&q.op=le&q.value=34&
q.field=that&q.op=eq&q.value=foo&
"?q.field=this&q.field=that&
q.op=le&q.op=eq&
q.type=&q.type=string&
q.value=34&q.value=foo&
foo=bar&sna=fu"
'''
if q:
@@ -55,9 +58,10 @@ def cli_to_array(cli_query):
"""This converts from the cli list of queries to what is required
by the python api.
so from:
"this<=34;that=foo"
"this<=34;that=string::foo"
to
"[{field=this,op=le,value=34},{field=that,op=eq,value=foo}]"
"[{field=this,op=le,value=34,type=''},
{field=that,op=eq,value=foo,type=string}]"
"""