diff options
| author | Jenkins <jenkins@review.openstack.org> | 2016-08-11 15:29:20 +0000 |
|---|---|---|
| committer | Gerrit Code Review <review@openstack.org> | 2016-08-11 15:29:20 +0000 |
| commit | 9a440b9f06fb7bd2872170356969df93779c3f29 (patch) | |
| tree | f6bf7929e779be84fbfa7abc8b9de013ce24f852 /saharaclient/api/base.py | |
| parent | d004de42072b93f7142397900ae753f03d018daa (diff) | |
| parent | f3b00004b01e5ad1e17ae82d91c72ea5bc9dd70c (diff) | |
| download | python-saharaclient-0.17.0.tar.gz | |
Merge "Add sorting ability to Python-saharaclient"0.17.0
Diffstat (limited to 'saharaclient/api/base.py')
| -rw-r--r-- | saharaclient/api/base.py | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/saharaclient/api/base.py b/saharaclient/api/base.py index aae3211..36c9e45 100644 --- a/saharaclient/api/base.py +++ b/saharaclient/api/base.py @@ -251,12 +251,18 @@ class APIException(Exception): self.error_message = error_message -def get_query_string(search_opts, limit=None, marker=None): +def get_query_string(search_opts, limit=None, marker=None, sort_by=None, + reverse=None): opts = {} if marker is not None: opts['marker'] = marker if limit is not None: opts['limit'] = limit + if sort_by is not None: + if reverse: + opts['sort_by'] = "-%s" % sort_by + else: + opts['sort_by'] = sort_by if search_opts is not None: opts.update(search_opts) if opts: |
