[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

On patching bts_webui



There's one thing that I would like to see in the Debian BTS: automatic 
linking to other bug reports every time someone writes #NNNNNN.
I would like to file a wishlist report against it with a patch, but I don't
know how to try it beforehand - the svn trunk can run a self-contained 
server, but I don't know how to generate and feed it a bug database.
Any suggestions?
A temptative patch follows.

Cheers,

Luca
 
---
diff -ru bts-webui/bts_webui/amancay/bugs.py bts-webui.new/bts_webui/amancay/bugs.py
--- bts-webui/bts_webui/amancay/bugs.py	2009-11-15 16:25:34.155705156 +0100
+++ bts-webui.new/bts_webui/amancay/bugs.py	2009-10-28 19:45:38.994111278 +0100
@@ -40,7 +40,8 @@
 	from_re = re.compile('^From: ?(.+)$', re.MULTILINE)
 	subject_re = re.compile('^Subject: ?(.+)$', re.MULTILINE)
 	date_re = re.compile('^Date: ?(.+)$', re.MULTILINE)
-
+	bugnumber_re = re.compile('#([0-9]{6})')
+	
 	bug_messages = []
 	for item in bug_log:
 		message = {}
@@ -83,6 +84,7 @@
 		else:
 			message['body'] = content.get_payload(decode=1)
 
+		message['body'] = bugnumber_re.sub(r'<a href"http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=\1";>#\1</a>' , message['body'])
 		bug_messages.append(message)
 
 	return render_to_response('bug.html',


Reply to: