Grotti 3.5.0: Pagination, Logging, Deb-Paket, Makro-Doku, PLA-Match-Fix.
This commit is contained in:
1 parent
4ffe1dcfc6
commit
f1f79c2ce2
38 files changed
+1062
-75
No files matched your search
+12
-4
@@ -19,7 +19,7 @@ from werkzeug.middleware.proxy_fix import ProxyFix
|
||||
from grotti import auth as grotti_auth
|
||||
from grotti import config as grotti_config
|
||||
from grotti import db as grotti_db
|
||||
from grotti import eject, jobs, library, moonraker, notify, store
|
||||
from grotti import eject, jobs, library, logutil, moonraker, notify, store
|
||||
from grotti.catalog import color_catalog
|
||||
from grotti.cost import calculate, offer_from_file, order_actuals
|
||||
from grotti import orders as grotti_orders
|
||||
@@ -32,6 +32,8 @@ from grotti.version import __version__
|
||||
from grotti import verdict as grotti_verdict
|
||||
from grotti.watcher import StateWatcher
|
||||
|
||||
log = logutil.get("grotti.web")
|
||||
|
||||
ROOT = Path(__file__).resolve().parent
|
||||
TOOL_ROOT = ROOT.parent
|
||||
DOCS_DIR = TOOL_ROOT / "docs"
|
||||
@@ -316,7 +318,7 @@ def create_app(cfg):
|
||||
message = "Diesen Eintrag gibt es schon."
|
||||
elif isinstance(err, psycopg.errors.InvalidTextRepresentation):
|
||||
message = "Ungültiger Wert in der Anfrage."
|
||||
print("DB: %s" % err, flush=True)
|
||||
log.warning("DB: %s", err)
|
||||
return jsonify({"error": message, "code": "db"}), 500
|
||||
|
||||
def body():
|
||||
@@ -582,6 +584,7 @@ def create_app(cfg):
|
||||
|
||||
ANLEITUNG_ORDER = (
|
||||
"Anleitung-Einrichtung",
|
||||
"Anleitung-Installation-Pi",
|
||||
"Anleitung-Oberflaeche",
|
||||
"Anleitung-Wand",
|
||||
"Anleitung-Dateien",
|
||||
@@ -605,6 +608,7 @@ def create_app(cfg):
|
||||
def anleitung_title(name):
|
||||
labels = {
|
||||
"Anleitung-Einrichtung": "Einrichtung",
|
||||
"Anleitung-Installation-Pi": "Raspberry Pi (.deb)",
|
||||
"Anleitung-Oberflaeche": "Oberfläche",
|
||||
"Anleitung-Wand": "Druckerwand",
|
||||
"Anleitung-Dateien": "Dateien senden",
|
||||
@@ -1698,7 +1702,7 @@ def create_app(cfg):
|
||||
try:
|
||||
jobs.apply_deduction(c, closed, cfg["energy"])
|
||||
except Exception as exc:
|
||||
print("Abräumen Abzug %s: %s" % (host, exc), flush=True)
|
||||
log.warning("Abräumen Abzug %s: %s", host, exc)
|
||||
row = store.get_run_row(c, closed["id"]) or closed
|
||||
run_json = store.run_out(row)
|
||||
reprint = None
|
||||
@@ -2451,7 +2455,11 @@ def create_app(cfg):
|
||||
|
||||
@app.get("/api/v1/laeufe")
|
||||
def run_list():
|
||||
return jsonify(store.list_runs(conn()))
|
||||
try:
|
||||
limit = min(1000, max(1, int(request.args.get("limit") or 500)))
|
||||
except (TypeError, ValueError):
|
||||
limit = 500
|
||||
return jsonify(store.list_runs(conn(), limit=limit))
|
||||
|
||||
@app.get("/api/v1/laeufe/aktuell")
|
||||
def run_aktuell():
|
||||
|
||||
Reference in new issue
Block a user