diff options
author | Jenkins <jenkins@review.openstack.org> | 2014-11-26 19:13:30 +0000 |
---|---|---|
committer | Gerrit Code Review <review@openstack.org> | 2014-11-26 19:13:30 +0000 |
commit | eadb40ccb62566f02cb93ec03aa232e48835dec3 (patch) | |
tree | ee02fc209277c6af9c3f4992351d70ed00ea69c6 /saharaclient/api/base.py | |
parent | f09c4c8d3de632dc7b7b3b3a1c4eb32d7ccd3652 (diff) | |
parent | 36d8a134d679d9c0e6c9b09c3c1c584a32797cfb (diff) | |
download | python-saharaclient-eadb40ccb62566f02cb93ec03aa232e48835dec3.tar.gz |
Merge "Adding support for query filtering to list() calls"0.7.6
Diffstat (limited to 'saharaclient/api/base.py')
-rw-r--r-- | saharaclient/api/base.py | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/saharaclient/api/base.py b/saharaclient/api/base.py index c2c9c36..ee85c2d 100644 --- a/saharaclient/api/base.py +++ b/saharaclient/api/base.py @@ -17,6 +17,7 @@ import json import logging import six +from six.moves.urllib import parse from saharaclient.openstack.common.gettextutils import _ @@ -161,3 +162,12 @@ class APIException(Exception): self.error_code = error_code self.error_name = error_name self.error_message = error_message + + +def get_query_string(search_opts): + if search_opts: + qparams = sorted(search_opts.items(), key=lambda x: x[0]) + query_string = "?%s" % parse.urlencode(qparams) + else: + query_string = "" + return query_string
\ No newline at end of file |