예제 #1
0
파일: api.py 프로젝트: Hermy/foofind-web
def api_v1():
    method = request.args.get("method", None)
    results = ()
    success = False
    try:
        if method == "getSearch":
            query = request.args["q"]
            s = searchd.search(query, request.args, start=True, group=True, no_group=True)
            ids = list(s.get_results((1.4, 0.1), last_items=[], min_results=100, max_results=100, extra_browse=0))
            stats = s.get_stats()
            results = enumerate(filter(None, [secure_fill_data(f,text=query) for f in filesdb.get_files(ids,True)]))
            success = True
    except BaseException as e:
        logging.debug(e)

    return render_template("api/v1.xml",
        api_method=method,
        results=results,
        success = success
        )
예제 #2
0
파일: cache.py 프로젝트: Hermy/foofind-web
 def cacheme(self, v):
     try:
         g.cache_cacheme = bool(v)
     except RuntimeError as e:
         # Si no hay contexto no hace falta controlar el caché
         logging.debug("cache.cacheme accessed without context", extra={"e":e})