def dirbrowser_html(path):
 title = 'Browse directory: {}'.format(path)
 if is_root(path):
  parent = None
 else:
  parent = parent_dir(path)
 try:
  all_files = os.listdir(path)
 except OSError as e:
  html = jinja.render('error.html', title='Error while reading directory', url='file:///{}'.format(path), error=str(e), icon='')
  return html.encode('UTF-8', errors='xmlcharrefreplace')
 files = get_file_list(path, all_files, os.path.isfile)
 directories = get_file_list(path, all_files, os.path.isdir)
 html = jinja.render('dirbrowser.html', title=title, url=path, icon='', parent=parent, files=files, directories=directories)
 return html.encode('UTF-8', errors='xmlcharrefreplace')

def dirbrowser_html ( path ) : title = 'Browse directory: {}' . format ( path ) if is_root ( path ) : parent = None else : parent = parent_dir ( path ) try : all_files = os . listdir ( path ) except OSError as e : html = jinja . render ( 'error.html' , title = 'Error while reading directory' , url = 'file:///{}' . format ( path ) , error = str ( e ) , icon = '' ) return html . encode ( 'UTF-8' , errors = 'xmlcharrefreplace' ) files = get_file_list ( path , all_files , os . path . isfile ) directories = get_file_list ( path , all_files , os . path . isdir ) html = jinja . render ( 'dirbrowser.html' , title = title , url = path , icon = '' , parent = parent , files = files , directories = directories ) return html . encode ( 'UTF-8' , errors = 'xmlcharrefreplace' )
get the directory browser web page .