| 187 | raise TemplateNotFound(template) |
| 188 | |
| 189 | def list_templates(self): |
| 190 | found = set() |
| 191 | for searchpath in self.searchpath: |
| 192 | walk_dir = os.walk(searchpath, followlinks=self.followlinks) |
| 193 | for dirpath, dirnames, filenames in walk_dir: |
| 194 | for filename in filenames: |
| 195 | template = os.path.join(dirpath, filename) \ |
| 196 | [len(searchpath):].strip(os.path.sep) \ |
| 197 | .replace(os.path.sep, '/') |
| 198 | if template[:2] == './': |
| 199 | template = template[2:] |
| 200 | if template not in found: |
| 201 | found.add(template) |
| 202 | return sorted(found) |
| 203 | |
| 204 | |
| 205 | class PackageLoader(BaseLoader): |