Mercurial > p > roundup > code
comparison roundup/cgi/templating.py @ 6700:fadd8d5775a1
Handle case where template file doesn't exist.
If a template file is a dangling symbolic link, it used to raise a
"TypeError: 'NoneType' object is not iterable". Replace that useless
error with a NoTemplate exception reporting the problem file.
| author | John Rouillard <rouilj@ieee.org> |
|---|---|
| date | Tue, 14 Jun 2022 20:34:16 -0400 |
| parents | 994893cf3e1a |
| children | 99f87b1aefe8 |
comparison
equal
deleted
inserted
replaced
| 6693:9a1f5e496e6c | 6700:fadd8d5775a1 |
|---|---|
| 296 realpath = os.path.realpath(src) | 296 realpath = os.path.realpath(src) |
| 297 if not realpath.startswith(realsrc): | 297 if not realpath.startswith(realsrc): |
| 298 return # will raise invalid template | 298 return # will raise invalid template |
| 299 if os.path.exists(src): | 299 if os.path.exists(src): |
| 300 return (src, f) | 300 return (src, f) |
| 301 raise NoTemplate("Unable to load template: %s"%name) | |
| 301 | 302 |
| 302 def check(self, name): | 303 def check(self, name): |
| 303 return bool(self._find(name)) | 304 return bool(self._find(name)) |
| 304 | 305 |
| 305 def precompile(self): | 306 def precompile(self): |
