summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorEmilio Pozuelo Monfort <pochu@debian.org>2020-07-16 16:04:58 +0200
committerEmilio Pozuelo Monfort <pochu@debian.org>2020-07-29 10:20:41 +0200
commit9ea98eb6bccdfdeb03c80bd1683590d6d7251990 (patch)
tree3e387715e55e224fcab63aaaa3780802040f3c62 /lib
parent2a9d943122428af480b5b1fa7d7320b3daa97e6f (diff)
web_support.py: make_list: don't subscript the list
We may get objects that are not subscriptable in py3, such as map objects, so just iterate over the whole object and pop the last separator instead.
Diffstat (limited to 'lib')
-rw-r--r--lib/python/web_support.py10
1 files changed, 5 insertions, 5 deletions
diff --git a/lib/python/web_support.py b/lib/python/web_support.py
index 50d62757e8..1ad6a7f51f 100644
--- a/lib/python/web_support.py
+++ b/lib/python/web_support.py
@@ -527,11 +527,11 @@ def make_list(lst, separator=", "):
assert not isstring(lst)
c = []
if lst:
- append = c.append
- for e in lst[:-1]:
- append(e)
- append(separator)
- append(lst[-1])
+ for e in lst:
+ c.append(e)
+ c.append(separator)
+ # pop the final separator
+ c.pop()
return Compose(c)
class InvalidPath(Exception):

© 2014-2024 Faster IT GmbH | imprint | privacy policy