summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZhiQiang Fan <zhiqiang.fan@huawei.com>2014-04-15 14:41:45 +0800
committerZhiQiang Fan <zhiqiang.fan@huawei.com>2014-04-15 14:53:25 +0800
commitb3da9638264d3bc57a1341e86cc860c496195cfc (patch)
tree159a57cfe5e35a6a3f107d9f3d41b9813f019013
parente56da49b60eda53b743f1f5391a323e4e2f0fcfe (diff)
downloadpython-ceilometerclient-b3da9638264d3bc57a1341e86cc860c496195cfc.tar.gz
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
-rw-r--r--ceilometerclient/v2/options.py14
1 files changed, 9 insertions, 5 deletions
diff --git a/ceilometerclient/v2/options.py b/ceilometerclient/v2/options.py
index 6649971..e28e05b 100644
--- a/ceilometerclient/v2/options.py
+++ b/ceilometerclient/v2/options.py
@@ -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}]"
"""