{% python import difflib %}\
{% python from allura.model import User %}\
{% for key, values in changelist %}\
{% choose %}\
{% when key == 'description' %}\
- Description has changed:

Diff:

~~~~

${'\n'.join(difflib.unified_diff(
                            a=values[0].splitlines(),
                            b=values[1].splitlines(),
                            fromfile='old',
                            tofile='new',
                            lineterm=''))}

~~~~

{% end %}\
{% otherwise %}\
{% with oldv, newv = values %}\
{% choose %}\
{% when key == 'assigned_to' or isinstance(oldv, User) or isinstance(newv, User) %}\
- **${key}**: {% if oldv %}${oldv.get_pref('display_name')} --> {% end %}{% choose %}{% when newv %}${newv.get_pref('display_name')}{% end %}{% otherwise %} nobody {% end %}{% end %}
{% end %}\
{% when key == 'labels' %}\
- **${key}**: ${', '.join(oldv)} --> ${', '.join(newv)}
{% end %}\
{% otherwise %}\
- **${key}**: ${oldv} --> ${newv}
{% end %}\
{% end %}\
{% end %}\
{% end %}\
{% end %}\
{% end %}\
