From 7a115ab3081b6697fb68a9b43804ccb5093efbe5 Mon Sep 17 00:00:00 2001 From: SergBobrovsky Date: Sat, 2 Jan 2021 19:01:55 +0300 Subject: [PATCH] refactor ResourceManager.add_path() a bit shorter --- bottle.py | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/bottle.py b/bottle.py index 23fff762..b420fdfe 100755 --- a/bottle.py +++ b/bottle.py @@ -2695,10 +2695,8 @@ def add_path(self, path, base=None, index=None, create=False): self.path.remove(path) if create and not os.path.isdir(path): os.makedirs(path) - if index is None: - self.path.append(path) - else: - self.path.insert(index, path) + if index is None: index = len(self.path) + self.path.insert(index, path) self.cache.clear() return os.path.exists(path)