Changeset View
Changeset View
Standalone View
Standalone View
swh/web/browse/views/directory.py
Show All 25 Lines | |||||
@browse_route(r'directory/(?P<sha1_git>[0-9a-f]+)/', | @browse_route(r'directory/(?P<sha1_git>[0-9a-f]+)/', | ||||
r'directory/(?P<sha1_git>[0-9a-f]+)/(?P<path>.+)/', | r'directory/(?P<sha1_git>[0-9a-f]+)/(?P<path>.+)/', | ||||
view_name='browse-directory', | view_name='browse-directory', | ||||
checksum_args=['sha1_git']) | checksum_args=['sha1_git']) | ||||
def directory_browse(request, sha1_git, path=None): | def directory_browse(request, sha1_git, path=None): | ||||
"""Django view for browsing the content of a directory identified | """Django view for browsing the content of a directory identified | ||||
by its sha1_git value. | by its sha1_git value. | ||||
The url that points to it is :http:get:`/browse/directory/(sha1_git)/[(path)/]` | The url that points to it is | ||||
""" # noqa | :http:get:`/browse/directory/(sha1_git)/[(path)/]` | ||||
""" | |||||
root_sha1_git = sha1_git | root_sha1_git = sha1_git | ||||
try: | try: | ||||
if path: | if path: | ||||
dir_info = service.lookup_directory_with_path(sha1_git, path) | dir_info = service.lookup_directory_with_path(sha1_git, path) | ||||
sha1_git = dir_info['target'] | sha1_git = dir_info['target'] | ||||
dirs, files = get_directory_entries(sha1_git) | dirs, files = get_directory_entries(sha1_git) | ||||
origin_type = request.GET.get('origin_type', None) | origin_type = request.GET.get('origin_type', None) | ||||
▲ Show 20 Lines • Show All 134 Lines • Show Last 20 Lines |