Skip to content

Commit

Permalink
lower-case boolean query params
Browse files Browse the repository at this point in the history
  • Loading branch information
Russell Haering committed Oct 21, 2013
1 parent aa65620 commit 7717b47
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion txetcd/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,15 @@ def _log_failure(self, failure):
log.err(failure)
return failure

def _format_param_value(self, value):
if isinstance(value, bool):
if value:
return 'true'
else:
return 'false'
else:
return value

def _request(self, method, path, params=None, data=None, prefer_leader=False):
node = self._get_node(prefer_leader=prefer_leader)
url = 'http://{host}:{port}/{version}{path}'.format(
Expand All @@ -111,7 +120,7 @@ def _request(self, method, path, params=None, data=None, prefer_leader=False):
kwargs['data'] = urlencode(data)

if params:
kwargs['params'] = params
kwargs['params'] = {key:self._format_param_value(value) for key, value in params.iteritems()}

d = self.http_client.request(method, url, headers=headers, **kwargs)
d.addErrback(self._log_failure)
Expand Down

0 comments on commit 7717b47

Please sign in to comment.