Runs live, versioned Python application objects on one VM, with a suite of apps: projects, notes, tasks, files and more.

9 downloads

Install on DigitalOcean Download zip
Clone
Clone with git
git clone https://gitstable.com/git/askrobots/dbbasic-object-server.git
HTTPS
https://gitstable.com/git/askrobots/dbbasic-object-server.git
SSH
ssh://git@gitstable.com:2222/askrobots/dbbasic-object-server.git

Cloning needs no sign-in. Pushing over HTTPS asks for your username and an access token. SSH needs your key under SSH keys.

Daniel Quellhorst Changelog for this batch. 65ef78d 3 hours, 49 minutes ago History
fringe_benefits.py · 1.1 KB · 27 lines
1"""hook_fringe_benefits -- the one rule the register's fields cannot declare.
2
3A benefit's period must not end before it starts. Two fields compared
4with each other is beyond `validation` (a bound is a constant), so it is a
5locked check on the record's own fields (docs/package-authoring.md, "What
6can't be declared"): no `reads`, one flock round trip, and it holds for
7every writer -- an import of last year's register as much as the form.
8Dates are YYYY-MM-DD strings, which the schema has already validated, and
9compare in date order.
10"""
11
12
13def LOCKED_CHECK(request):
14 record = request.get("record") or {}
15 start = str(record.get("period_start") or "").strip()
16 end = str(record.get("period_end") or "").strip()
17 if start and end and end < start:
18 return {"error": f"The period ends ({end}) before it starts ({start}).", "status": 409}
19 return None
20
21
22def BEFORE_WRITE(request):
23 """The same answer early, for the API: the check decides it again inside
24 the lock for every writer. No position on a delete."""
25 if request.get("action") not in ("create", "update"):
26 return None
27 return LOCKED_CHECK(request)