summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarcel Hellkamp <marc@gsites.de>2019-12-18 12:05:35 +0100
committerMarcel Hellkamp <marc@gsites.de>2019-12-18 12:05:35 +0100
commit085f18615fe8ab63588eebfd25bb90337aac2ba0 (patch)
tree9be21756a8ccbef3a27660010eabc26103e89acd
parent5c52eb0c0b7f21836375b3584896094735171a9f (diff)
downloadbottle-085f18615fe8ab63588eebfd25bb90337aac2ba0.tar.gz
fix #1186: Bottle fails to find templates on windows
os.sep contains a backslash on windows, but os.path.abspath() normalizes paths to forward slashes. Hard-coding a forward slash on any platform is actually more correct here.
-rwxr-xr-xbottle.py5
1 files changed, 2 insertions, 3 deletions
diff --git a/bottle.py b/bottle.py
index 1063e2a..d2d1f0c 100755
--- a/bottle.py
+++ b/bottle.py
@@ -2695,8 +2695,7 @@ class ResourceManager(object):
res.add_path('./resources/', __file__)
"""
base = os.path.abspath(os.path.dirname(base or self.base))
- path = os.path.abspath(os.path.join(base, os.path.dirname(path)))
- path += os.sep
+ path = os.path.abspath(os.path.join(base, os.path.dirname(path))) + "/"
if path in self.path:
self.path.remove(path)
if create and not os.path.isdir(path):
@@ -3838,7 +3837,7 @@ class BaseTemplate(object):
"Refer to templates with names or paths relative to the lookup path.")
for spath in lookup:
- spath = os.path.abspath(spath) + os.sep
+ spath = os.path.abspath(spath) + "/"
fname = os.path.abspath(os.path.join(spath, name))
if not fname.startswith(spath): continue
if os.path.isfile(fname): return fname