Split a path into segments and perform a sanity check. If it detects '..' in the path it will raise a `TemplateNotFound` error.
(template)
| 20 | |
| 21 | |
| 22 | def split_template_path(template): |
| 23 | """Split a path into segments and perform a sanity check. If it detects |
| 24 | '..' in the path it will raise a `TemplateNotFound` error. |
| 25 | """ |
| 26 | pieces = [] |
| 27 | for piece in template.split('/'): |
| 28 | if path.sep in piece \ |
| 29 | or (path.altsep and path.altsep in piece) or \ |
| 30 | piece == path.pardir: |
| 31 | raise TemplateNotFound(template) |
| 32 | elif piece and piece != '.': |
| 33 | pieces.append(piece) |
| 34 | return pieces |
| 35 | |
| 36 | |
| 37 | class BaseLoader(object): |
no test coverage detected