fix: garde-fou edition base sur label projet au lieu de TYPES_SYSTEME fige
- _est_editable() dans trilium_api.py : editable si label projet ou type=projet - tool_update_note + delete_note_safe utilisent ce critere - tool_get_children : filtre TYPES_SYSTEME retire (transparence) Corrige : composants techniques editables, get_children ne les masque plus. Revele par le test Phase 3 (agent bloque sur edition de composant).
This commit is contained in:
+4
-12
@@ -460,30 +460,22 @@ def tool_get_note(note_id):
|
||||
"contenu": get_note_content(note_id)}
|
||||
|
||||
def tool_get_children(parent_id):
|
||||
from trilium_api import TYPES_SYSTEME
|
||||
out = []
|
||||
for child in get_children(parent_id):
|
||||
cid = child.get("noteId")
|
||||
n = get_note(cid)
|
||||
if not n:
|
||||
continue
|
||||
tv = _type_systeme(n)
|
||||
if tv in TYPES_SYSTEME:
|
||||
out.append({"id": cid, "titre": n.get("title", ""), "type": tv})
|
||||
out.append({"id": cid, "titre": n.get("title", ""), "type": _type_systeme(n)})
|
||||
return {"parent": parent_id, "count": len(out), "notes": out}
|
||||
|
||||
def tool_update_note(note_id, contenu, format="markdown"):
|
||||
from trilium_api import TYPES_SYSTEME
|
||||
from trilium_api import _est_editable
|
||||
note = get_note(note_id)
|
||||
if not note:
|
||||
return {"error": "Note introuvable"}
|
||||
type_val = None
|
||||
for a in note.get("attributes", []):
|
||||
if a.get("type") == "label" and a.get("name") == "type":
|
||||
type_val = a.get("value")
|
||||
break
|
||||
if type_val not in TYPES_SYSTEME:
|
||||
return {"error": "Refus : note sans type systeme connu (type=%s)" % type_val}
|
||||
if not _est_editable(note):
|
||||
return {"error": "Refus : note structurelle protegee (sans label projet)"}
|
||||
if format == "html":
|
||||
body = contenu
|
||||
else:
|
||||
|
||||
Reference in New Issue
Block a user