~ubuntu-branches/ubuntu/utopic/python-ceilometerclient/utopic

« back to all changes in this revision

Viewing changes to ceilometerclient/v2/options.py

  • Committer: Package Import Robot
  • Author(s): Chuck Short, James Page, Chuck Short
  • Date: 2014-01-21 09:53:01 UTC
  • mfrom: (1.1.6)
  • Revision ID: package-import@ubuntu.com-20140121095301-cwxsrtdgddkzprjx
Tags: 1.0.8-0ubuntu1
[ James Page ]
* d/control: Add missing BD on python-babel. 

[ Chuck Short ]
* New upstream release.

Show diffs side-by-side

added added

removed removed

Lines of Context:
11
11
#    License for the specific language governing permissions and limitations
12
12
#    under the License.
13
13
 
 
14
from ceilometerclient.openstack.common.py3kcompat import urlutils
14
15
import re
15
 
import urllib
16
16
 
17
17
 
18
18
def build_url(path, q, params=None):
34
34
            for name in ['field', 'op', 'value']:
35
35
                query_params['q.%s' % name].append(query.get(name, ''))
36
36
 
37
 
        path += "?" + urllib.urlencode(query_params, doseq=True)
 
37
        # Transform the dict to a sequence of two-element tuples in fixed
 
38
        # order, then the encoded string will be consistent in Python 2&3.
 
39
        new_qparams = sorted(query_params.items(), key=lambda x: x[0])
 
40
        path += "?" + urlutils.urlencode(new_qparams, doseq=True)
38
41
 
39
42
        if params:
40
43
            for p in params: