Mercurial > libervia-backend
changeset 3520:8acaf857cd0a
jp (blog/get): fix comments node parsing
author | Goffi <goffi@goffi.org> |
---|---|
date | Sat, 01 May 2021 18:38:58 +0200 |
parents | 02eec2a5b5f9 |
children | 62f490eff51c |
files | sat_frontends/jp/cmd_blog.py |
diffstat | 1 files changed, 3 insertions(+), 6 deletions(-) [+] |
line wrap: on
line diff
--- a/sat_frontends/jp/cmd_blog.py Sat May 01 18:37:57 2021 +0200 +++ b/sat_frontends/jp/cmd_blog.py Sat May 01 18:38:58 2021 +0200 @@ -265,17 +265,14 @@ return {"blog_items": blog_items} def format_comments(self, item, keys): - comments_data = data_format.dict2iterdict( - "comments", item, ("node", "service"), pop=True - ) lines = [] - for data in comments_data: - lines.append(data["comments"]) + for data in item.get('comments', []): + lines.append(data["uri"]) for k in ("node", "service"): if OUTPUT_OPT_NO_HEADER in self.args.output_opts: header = "" else: - header = C.A_HEADER + k + ": " + A.RESET + header = f"{C.A_HEADER}comments_{k}: {A.RESET}" lines.append(header + data[k]) return "\n".join(lines)