Пример #1
0
 def dispatch_request(self):
     update_ts_file = current_app.config["CACHE_DIR"] / "last-update"
     last_update = local_info.read_update_ts(update_ts_file)
     try:
         session.query(Package).first().id  # database check
     except Exception:
         return jsonify(dict(status="db error", http_status_code=500)), 500
     return jsonify(
         dict(status="ok", http_status_code=200, last_update=last_update))
Пример #2
0
def ping():
    update_ts_file = os.path.join(app.config['CACHE_DIR'], 'last-update')
    last_update = local_info.read_update_ts(update_ts_file)
    try:
        session.query(Package).first().id  # database check
    except:
        return jsonify(dict(status="db error", http_status_code=500)), 500
    return jsonify(dict(status="ok",
                        http_status_code=200,
                        last_update=last_update))
Пример #3
0
def skeleton_variables():
    update_ts_file = os.path.join(app.config['CACHE_DIR'], 'last-update')
    last_update = local_info.read_update_ts(update_ts_file)

    packages_prefixes = PackageName.get_packages_prefixes(
        app.config["CACHE_DIR"])

    credits_file = os.path.join(app.config["LOCAL_DIR"], "credits.html")
    credits = local_info.read_html(credits_file)

    return dict(packages_prefixes=packages_prefixes,
                searchform=SearchForm(),
                last_update=last_update,
                credits=credits)
Пример #4
0
def skeleton_variables():
    update_ts_file = os.path.join(app.config['CACHE_DIR'], 'last-update')
    # TODO, this part should be moved to per blueprint context processor
    last_update = local_info.read_update_ts(update_ts_file)

    packages_prefixes = qry.pkg_names_get_packages_prefixes(
        app.config["CACHE_DIR"])

    credits_file = os.path.join(app.config["LOCAL_DIR"], "credits.html")
    credits = local_info.read_html(credits_file)

    return dict(packages_prefixes=packages_prefixes,
                searchform=SearchForm(),
                last_update=last_update,
                credits=credits)
Пример #5
0
def skeleton_variables():
    update_ts_file = os.path.join(app.config['CACHE_DIR'], 'last-update')
    # TODO, this part should be moved to per blueprint context processor
    last_update = local_info.read_update_ts(update_ts_file)

    packages_prefixes = qry.pkg_names_get_packages_prefixes(
        app.config["CACHE_DIR"])

    credits_file = os.path.join(app.config["LOCAL_DIR"], "credits.html")
    credits = local_info.read_html(credits_file)

    return dict(packages_prefixes=packages_prefixes,
                searchform=SearchForm(),
                last_update=last_update,
                credits=credits,
                name=app.import_name)