##// END OF EJS Templates
hgweb: simplify staticfile() now that we always pass it a single directory...
Martin von Zweigbergk -
r45866:9a5c4875 default
parent child Browse files
Show More
@@ -191,12 +191,7 b' def staticfile(directory, fname, res):'
191 return
191 return
192
192
193 fpath = os.path.join(*fname.split(b'/'))
193 fpath = os.path.join(*fname.split(b'/'))
194 if isinstance(directory, bytes):
194 path = os.path.join(directory, fpath)
195 directory = [directory]
196 for d in directory:
197 path = os.path.join(d, fpath)
198 if os.path.exists(path):
199 break
200 try:
195 try:
201 os.stat(path)
196 os.stat(path)
202 ct = pycompat.sysbytes(
197 ct = pycompat.sysbytes(
@@ -416,7 +416,7 b' class hgwebdir(object):'
416 if not static:
416 if not static:
417 tp = self.templatepath or templater.templatedir()
417 tp = self.templatepath or templater.templatedir()
418 if tp is not None:
418 if tp is not None:
419 static = [os.path.join(tp, b'static')]
419 static = os.path.join(tp, b'static')
420
420
421 staticfile(static, fname, res)
421 staticfile(static, fname, res)
422 return res.sendresponse()
422 return res.sendresponse()
@@ -1320,7 +1320,7 b' def static(web):'
1320 static = web.config(b"web", b"static", untrusted=False)
1320 static = web.config(b"web", b"static", untrusted=False)
1321 if not static:
1321 if not static:
1322 tp = web.templatepath or templater.templatedir()
1322 tp = web.templatepath or templater.templatedir()
1323 static = [os.path.join(tp, b'static')]
1323 static = os.path.join(tp, b'static')
1324
1324
1325 staticfile(static, fname, web.res)
1325 staticfile(static, fname, web.res)
1326 return web.res.sendresponse()
1326 return web.res.sendresponse()
General Comments 0
You need to be logged in to leave comments. Login now