comparison hgext/phabricator.py @ 41078:46e0563c67db

merge with stable
author Yuya Nishihara <yuya@tcha.org>
date Sun, 30 Dec 2018 17:31:57 +0900
parents 536beb130f3c d7d3164e6a31
children 9d35ae3d9999
comparison
equal deleted inserted replaced
41077:517a51d9cd7f 41078:46e0563c67db
153 flattened to {'a[0]': 'b', 'a[1]': 'c', 'd[e]': 'f'} and then passed to 153 flattened to {'a[0]': 'b', 'a[1]': 'c', 'd[e]': 'f'} and then passed to
154 urlencode. Note: the encoding is consistent with PHP's http_build_query. 154 urlencode. Note: the encoding is consistent with PHP's http_build_query.
155 """ 155 """
156 flatparams = util.sortdict() 156 flatparams = util.sortdict()
157 def process(prefix, obj): 157 def process(prefix, obj):
158 if isinstance(obj, bool):
159 obj = {True: b'true', False: b'false'}[obj] # Python -> PHP form
158 items = {list: enumerate, dict: lambda x: x.items()}.get(type(obj)) 160 items = {list: enumerate, dict: lambda x: x.items()}.get(type(obj))
159 if items is None: 161 if items is None:
160 flatparams[prefix] = obj 162 flatparams[prefix] = obj
161 else: 163 else:
162 for k, v in items(obj): 164 for k, v in items(obj):