Commit 60cda24d authored by Vincent Pelletier's avatar Vincent Pelletier

Collapse contiguous identical delimiters.

Fixes copy-paste of DateTimeField rendering into search expression, as it
separates time from date with 3 spaces.
parent 47ca5f17
......@@ -125,9 +125,14 @@ def countDelimiters(value):
value = ' '.join(split_value[:-1])
# Count delimiters
delimiter_count = 0
last_delimiter = None
for char in value:
if char in delimiter_list:
if char != last_delimiter:
delimiter_count += 1
last_delimiter = char
else:
last_delimiter = None
return delimiter_count
@profiler_decorator
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment