def POST(self): path = xutils.get_argument("path") if not path: path = xconfig.DATA_DIR find_key = xutils.get_argument("find_key", "") find_type = xutils.get_argument("type") mode = xutils.get_argument("mode") if find_key == "" or find_key is None: find_key = xutils.get_argument("key", "") find_key = "*" + find_key + "*" path_name = os.path.join(path, find_key) if find_key == "**": plist = [] elif os.path.abspath(path) == os.path.abspath( xconfig.DATA_DIR) and xconfig.USE_CACHE_SEARCH: # search in cache plist = find_in_cache(find_key) else: plist = xutils.search_path(path, find_key) # TODO max result size tpl = "fs/fs.html" if mode == "grid": tpl = "fs/fs_grid.html" return xtemplate.render( tpl, path=path, token=xauth.get_current_user().token, filelist=[xutils.FileItem(p, path) for p in plist])
def POST(self): path = xutils.get_argument("path") find_key = xutils.get_argument("find_key", "") find_type = xutils.get_argument("type") find_key = "*" + find_key + "*" path_name = os.path.join(path, find_key) if find_key == "": plist = [] else: plist = xutils.search_path(path, find_key) return xtemplate.render( "fs/fs.html", token=xauth.get_current_user().token, fspathlist=xutils.splitpath(path), filelist=[xutils.FileItem(p, path) for p in plist])
def POST(self): path = xutils.get_argument("path") find_key = xutils.get_argument("find_key") find_type = xutils.get_argument("type") find_key = "*" + find_key + "*" path_name = os.path.join(path, find_key) if find_key == "": plist = [] elif find_type == "glob": plist = limited_glob(path_name) else: plist = find_with_fnmatch(path, find_key) # plist = glob.glob(path_name) # plist += glob.glob(os.path.join(path, quoted_key)) # print(path, find_key) return xtemplate.render( "fs/fs.html", fspathlist=xutils.splitpath(path), filelist=[xutils.FileItem(p, path) for p in plist])