(path, base)
| 125 | |
| 126 | |
| 127 | def default_index_page(path, base): |
| 128 | urlpath = path[len(base):] or '/' |
| 129 | title = "Index of %s" % urlpath |
| 130 | dirs = [] if path == base else [('../', '')] # (name, doc) |
| 131 | files = [] # (name, doc) |
| 132 | for f in os.listdir(path): |
| 133 | if not filename_ok(f): |
| 134 | continue |
| 135 | |
| 136 | full_path = os.path.join(path, f) |
| 137 | if os.path.isfile(full_path): |
| 138 | if f.endswith('.py'): |
| 139 | code = open(full_path, encoding='utf8').read() |
| 140 | identifiers = identifiers_info(code) |
| 141 | if 'main' in identifiers: |
| 142 | files.append([f[:-3], identifiers['main']]) |
| 143 | else: |
| 144 | dirs.append([(f + '/'), '']) |
| 145 | |
| 146 | items = dirs + files |
| 147 | max_name_width = max([len(n) for n, _ in items] + [0]) |
| 148 | return _app_list_tpl.generate(files=items, title=title, max_name_width=max_name_width) |
| 149 | |
| 150 | |
| 151 | def get_app_from_path(request_path, base, index, reload=False): |
nothing calls this directly
no test coverage detected
searching dependent graphs…