From a75348cb7180c81862c4cc3118be28074c1449f7 Mon Sep 17 00:00:00 2001 From: Tim Abbott Date: Wed, 31 Oct 2012 11:49:17 -0400 Subject: [PATCH] Include the trac summary in the Humbug subject. (imported from commit 23298d8455e2b0e8c4947f2d2e76874b66a8e28c) --- bots/humbug_trac.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/bots/humbug_trac.py b/bots/humbug_trac.py index cbd06f9..f032ef3 100644 --- a/bots/humbug_trac.py +++ b/bots/humbug_trac.py @@ -29,8 +29,13 @@ def markdown_ticket_url(ticket, heading="ticket"): def markdown_block(desc): return "\n\n>" + "\n> ".join(desc.split("\n")) + "\n" +def truncate(string, length): + if len(string) <= length: + return string + return string[:length - 3] + "..." + def trac_subject(ticket): - return "Trac #%s" % ticket.id + return truncate("Trac #%s: %s" % (ticket.id, ticket.values.get("summary")), 60) def send_update(ticket, content): client.send_message({