mirror of
https://github.com/searxng/searxng.git
synced 2025-07-15 01:09:21 +02:00
[enh] test utils.prettify_url
This commit is contained in:
parent
da13c3b5f9
commit
7580852bda
2 changed files with 14 additions and 3 deletions
|
@ -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
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue