@blueprint.route('/autocomplete/path', methods=['GET'])
def path_autocomplete():
 path = flask.request.args.get('query', '')
 if (not os.path.isabs(path)):
  path = (os.path.sep + path)
 suggestions = [os.path.abspath(p) for p in glob.glob((path + '*'))]
 if (platform.system() == 'Windows'):
  suggestions = [p.replace('\\', '/') for p in suggestions]
 result = {'suggestions': sorted(suggestions)}
 return json.dumps(result)

@ blueprint . route ( '/autocomplete/path' , methods = [ 'GET' ] ) def path_autocomplete ( ) : path = flask . request . args . get ( 'query' , '' ) if ( not os . path . isabs ( path ) ) : path = ( os . path . sep + path ) suggestions = [ os . path . abspath ( p ) for p in glob . glob ( ( path + '*' ) ) ] if ( platform . system ( ) == 'Windows' ) : suggestions = [ p . replace ( '\\' , '/' ) for p in suggestions ] result = { 'suggestions' : sorted ( suggestions ) } return json . dumps ( result )
return a list of paths matching the specified preamble .