The export and the Markdown frontmatter write times through common.iso
common.iso is the server's one way to put a datetime on the wire, yet the JSON export and the importer's Markdown frontmatter wrote out the x.isoformat() if x else None idiom it replaces, seven times. Same output. DRY pass #2, batch 4, F10 (#5372). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -256,7 +256,7 @@ async def export_notes():
|
||||
payload: dict = {
|
||||
"app": "inkwell",
|
||||
"version": 1,
|
||||
"exported_at": datetime.now(timezone.utc).isoformat(),
|
||||
"exported_at": iso(datetime.now(timezone.utc)),
|
||||
"labels": [{"name": lb.name, "color": lb.color} for lb in all_labels],
|
||||
"notes": [],
|
||||
}
|
||||
@@ -273,10 +273,10 @@ async def export_notes():
|
||||
"body": n.body,
|
||||
"pinned": n.pinned,
|
||||
"archived": n.archived,
|
||||
"remind_at": n.remind_at.isoformat() if n.remind_at else None,
|
||||
"remind_at": iso(n.remind_at),
|
||||
"recurrence": n.recurrence,
|
||||
"created_at": n.created_at.isoformat() if n.created_at else None,
|
||||
"updated_at": n.updated_at.isoformat() if n.updated_at else None,
|
||||
"created_at": iso(n.created_at),
|
||||
"updated_at": iso(n.updated_at),
|
||||
"labels": [lb["name"] for lb in labels],
|
||||
"attachments": [
|
||||
{"file": f"attachments/{short}/{os.path.basename(a.path)}", "mime": a.mime} for a in atts
|
||||
|
||||
@@ -11,7 +11,7 @@ from datetime import datetime, timezone
|
||||
|
||||
from sqlalchemy import select
|
||||
|
||||
from ..common import parse_dt
|
||||
from ..common import iso, parse_dt
|
||||
from ..models.label import NoteLabel
|
||||
from ..models.note import Note
|
||||
from .helpers import (
|
||||
@@ -37,9 +37,9 @@ def _note_markdown(note: Note, labels: list) -> str:
|
||||
if note.archived:
|
||||
fm.append("archived: true")
|
||||
if note.remind_at:
|
||||
fm.append(f"remind_at: {note.remind_at.isoformat()}")
|
||||
fm.append(f"created: {note.created_at.isoformat() if note.created_at else ''}")
|
||||
fm.append(f"updated: {note.updated_at.isoformat() if note.updated_at else ''}")
|
||||
fm.append(f"remind_at: {iso(note.remind_at)}")
|
||||
fm.append(f"created: {iso(note.created_at) or ''}")
|
||||
fm.append(f"updated: {iso(note.updated_at) or ''}")
|
||||
fm.append("---")
|
||||
fm.append("")
|
||||
# Body and checklist are no longer alternatives — a note can carry both, so both
|
||||
|
||||
Reference in New Issue
Block a user