bcf - comments setter api

This commit is contained in:
Andrej730
2024-08-19 16:01:20 +05:00
parent 2ef3af5e1b
commit 7aa5b71a6a
2 changed files with 14 additions and 0 deletions
+5
View File
@@ -68,6 +68,11 @@ class TopicHandler:
"""Return the comments of the topic."""
return self.markup.comment if self.markup else []
@comments.setter
def comments(self, comments: list[mdl.Comment]) -> None:
assert self.markup
self.markup.comment = comments
@property
def bim_snippet(self) -> Optional[bytes]:
if not self._bim_snippet and self._topic_dir:
+9
View File
@@ -65,6 +65,15 @@ class TopicHandler:
"""Return the comments of the topic."""
return self.topic.comments.comment if self.topic.comments else []
@comments.setter
def comments(self, comments: list[mdl.Comment]) -> None:
topic_comments = self.topic.comments
if topic_comments is None:
if not comments:
return
self.topic.comments = (topic_comments := mdl.TopicComments())
topic_comments.comment = comments
@property
def bim_snippet(self) -> Optional[bytes]:
if not self._bim_snippet and self._topic_dir: