diff options
author | Adam Tauber <asciimoo@gmail.com> | 2015-09-07 19:22:01 +0200 |
---|---|---|
committer | Adam Tauber <asciimoo@gmail.com> | 2015-09-07 19:22:01 +0200 |
commit | 7580852bda660471f8968b4f14cdf44dad73249f (patch) | |
tree | 4ac4bdbee9658f691037b792ec8619581b4cd5ff /searx/utils.py | |
parent | da13c3b5f9b7f0a8691df4f53e817ac2116025b2 (diff) | |
download | searxng-7580852bda660471f8968b4f14cdf44dad73249f.tar.gz searxng-7580852bda660471f8968b4f14cdf44dad73249f.zip |
[enh] test utils.prettify_url
Diffstat (limited to 'searx/utils.py')
-rw-r--r-- | searx/utils.py | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/searx/utils.py b/searx/utils.py index cc31726b6..3651cc389 100644 --- a/searx/utils.py +++ b/searx/utils.py @@ -222,9 +222,10 @@ def dict_subset(d, properties): return result -def prettify_url(url): - if len(url) > 74: - return u'{0}[...]{1}'.format(url[:35], url[-35:]) +def prettify_url(url, max_length=74): + if len(url) > max_length: + chunk_len = max_length / 2 + 1 + return u'{0}[...]{1}'.format(url[:chunk_len], url[-chunk_len:]) else: return url |