[bug] Commenting on a non-head git changeset fails with TypeError in notification email (0.7.0, still in tip)

Mads Kiilerich mads at kiilerich.com
Thu Nov 26 00:53:18 UTC 2026


Hi

Thanks - I pushed a fix for that.

/Mads


On 29/09/2026 14:05, 橋本 憲一 wrote:
> Hi,
>
> Adding a comment to a git changeset that is not a branch head fails with HTTP 500, and the comment is not saved.
>
> Version: Kallithea 0.7.0 (Python 3.11). The same code is still present in tip.
>
> Steps to reproduce:
> 1. In a git repository, open a changeset that is not the head of any branch (for example, the parent of the master head).
> 2. Add a general (not inline) comment.
>
> Result: HTTP 500. The error log shows:
>
>    kallithea/model/comment.py, in create_notification
>    kallithea/model/notification.py, in get_email_tmpl
>        return email_template.render_unicode(**_kwargs)
>    mako/util.py, in getvalue
>        return self.delim.join(self.data)
>    TypeError: sequence item 16: expected str instance, NoneType found
>
> Cause: in kallithea/lib/vcs/backends/git/changeset.py, GitChangeset.branch returns None unless the commit is a branch head. kallithea/model/comment.py passes it through unchanged ('branch': cs.branch), and templates/email/changeset_comment.txt renders it with ${branch|n}, so rendering fails and the whole comment request is rolled back. Commenting on a branch-head changeset works.
>
> Possible fix: pass a string, for example 'branch': cs.branch or '' (or ', '.join(cs.branches)), or guard the value in changeset_comment.txt / changeset_comment.html.
>
> Regards,
> _______________________________________________
> kallithea-general mailing list
> kallithea-general at sfconservancy.org
> https://lists.sfconservancy.org/mailman/listinfo/kallithea-general




More information about the kallithea-general mailing list