From 90ccf83bf6356008e6a243dd68cce5aae7f2a74f Mon Sep 17 00:00:00 2001 From: MystyPy Date: Wed, 29 May 2024 12:20:09 +1000 Subject: [PATCH] Fix: Old pastes don't have annotations --- core/models.py | 2 +- views/htmx.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/core/models.py b/core/models.py index e8dab76..414d097 100644 --- a/core/models.py +++ b/core/models.py @@ -66,7 +66,7 @@ def __init__(self, record: asyncpg.Record | dict[str, Any]) -> None: self.loc: int = record["loc"] self.charcount: int = record["charcount"] self.index: int = record["file_index"] - self.annotation: str = record["annotation"] + self.annotation: str | None = record["annotation"] self.warning_positions: list[int] = record["warning_positions"] diff --git a/views/htmx.py b/views/htmx.py index 773c761..f2d1e83 100644 --- a/views/htmx.py +++ b/views/htmx.py @@ -54,7 +54,7 @@ def highlight_code(self, *, files: list[dict[str, Any]]) -> str: filename = "_".join(filename.splitlines()) raw_url: str = f'/raw/{file["parent_id"]}' - annotation: str = file["annotation"] + annotation: str = file["annotation"] or "" positions: list[int] = file.get("warning_positions", []) original: str = file["content"]