def comp_listing(request, directory_slug=None):
context = {}<EOL>working_dir = settings.COMPS_DIR<EOL>if directory_slug:<EOL><INDENT>working_dir = os.path.join(working_dir, directory_slug)<EOL><DEDENT>dirnames = []<EOL>templates = []<EOL>items = os.listdir(working_dir)<EOL>templates = [x for x in items if os.path.splitext(x)[<NUM_LIT:1>] == '<STR_LIT>']<EOL>dirnames = [x for x in items ifnot os.path.isfile(os.path.join(working_dir, x))]<EOL>templates.sort()<EOL>dirnames.sort()<EOL>context['<STR_LIT>'] = dirnames<EOL>context['<STR_LIT>'] = templates<EOL>context['<STR_LIT>'] = directory_slug<EOL>return render(request, "<STR_LIT>", context)<EOL>
Output the list of HTML templates and subdirectories in the COMPS_DIR