[enh] allow default empty values for normal and result proxies

This commit is contained in:
Adam Tauber 2017-07-19 21:33:44 +02:00
parent 1794f6a4d3
commit f2b13a7de0
2 changed files with 3 additions and 3 deletions

View file

@ -75,7 +75,7 @@ class SessionSinglePool(requests.Session):
def request(method, url, **kwargs):
"""same as requests/requests/api.py request(...) except it use SessionSinglePool and force proxies"""
session = SessionSinglePool()
kwargs['proxies'] = settings['outgoing'].get('proxies', None)
kwargs['proxies'] = settings['outgoing'].get('proxies') or None
response = session.request(method=method, url=url, **kwargs)
session.close()
return response

View file

@ -142,7 +142,7 @@ _category_names = (gettext('files'),
gettext('map'),
gettext('science'))
outgoing_proxies = settings['outgoing'].get('proxies', None)
outgoing_proxies = settings['outgoing'].get('proxies') or None
@babel.localeselector
@ -353,7 +353,7 @@ def render(template_name, override_theme=None, **kwargs):
kwargs['image_proxify'] = image_proxify
kwargs['proxify'] = proxify if settings.get('result_proxy') else None
kwargs['proxify'] = proxify if settings.get('result_proxy', {}).get('url') else None
kwargs['get_result_template'] = get_result_template