Don't leave falsey values out of dict_to_params, let caller do it.
Explicit is better than implicit and all that.
This commit is contained in:
parent
0fdf08adf5
commit
a00fb65758
2 changed files with 5 additions and 4 deletions
|
@ -425,7 +425,9 @@ def get_search_core():
|
||||||
|
|
||||||
if offset > 0:
|
if offset > 0:
|
||||||
prev_params = original_params.copy()
|
prev_params = original_params.copy()
|
||||||
prev_params['offset'] = max(0, offset - limit)
|
prev_offset = max(0, offset - limit)
|
||||||
|
if prev_offset > 0:
|
||||||
|
prev_params['offset'] = prev_offset
|
||||||
prev_params = helpers.dict_to_params(prev_params)
|
prev_params = helpers.dict_to_params(prev_params)
|
||||||
prev_page_url = '/search' + prev_params
|
prev_page_url = '/search' + prev_params
|
||||||
else:
|
else:
|
||||||
|
|
|
@ -7,9 +7,8 @@ def dict_to_params(d):
|
||||||
if not d:
|
if not d:
|
||||||
return ''
|
return ''
|
||||||
|
|
||||||
params = [f'{key}={value}' for (key, value) in d.items() if value]
|
params = [f'{key}={value}' for (key, value) in d.items()]
|
||||||
params = '&'.join(params)
|
params = '&'.join(params)
|
||||||
if params:
|
params = '?' + params
|
||||||
params = '?' + params
|
|
||||||
|
|
||||||
return params
|
return params
|
||||||
|
|
Loading…
Reference in a new issue