[Bf-extensions-cvs] SVN commit: /data/svn/bf-extensions [976] contrib/dev-tools/ search_bug_tracker.py: added flag for displaying the bug category

M.G. Kishalmi lmg at kishalmi.net
Fri Sep 3 14:41:24 CEST 2010


Revision: 976
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-extensions&revision=976
Author:   lmg
Date:     2010-09-03 14:41:24 +0200 (Fri, 03 Sep 2010)

Log Message:
-----------
added flag for displaying the bug category
added flag for displaying the link to bug details
fixed some typos

Modified Paths:
--------------
    contrib/dev-tools/search_bug_tracker.py

Modified: contrib/dev-tools/search_bug_tracker.py
===================================================================
--- contrib/dev-tools/search_bug_tracker.py	2010-09-03 07:26:27 UTC (rev 975)
+++ contrib/dev-tools/search_bug_tracker.py	2010-09-03 12:41:24 UTC (rev 976)
@@ -7,6 +7,9 @@
 # 2010_08_31:
 #	added proper handling of wrong login/password
 #	better windows support (tempdir + default colors off)
+# 2010_09_03:
+#	added flag for displaying the bug category
+#	added flag for displaying the link to bug details
 
 from __future__ import print_function
 import os
@@ -30,6 +33,7 @@
 
 URLLOGIN = "https://projects.blender.org/account/login.php"
 URLCSV = "https://projects.blender.org/tracker/?func=downloadcsv&group_id=9&atid=498"
+URLDETAIL = "https://projects.blender.org/tracker/index.php?func=detail&group_id=9&atid=498&aid="
 
 
 USERNAME = ''	# set to skip prompt
@@ -92,7 +96,7 @@
 		return file_age_seconds(LOCALCSV) < CACHETIME
 	return False
 
-def get_cvs_file(url_login, url_csv, username, password):
+def get_csv_file(url_login, url_csv, username, password):
 	o = urllib.request.build_opener(urllib.request.HTTPCookieProcessor())
 	urllib.request.install_opener(o)
 
@@ -116,11 +120,20 @@
 	)
 	parser.add_option(
 		'-u','--unassigned', action='store_true', 
-		dest='unassigned', help='Show only unassigned bugs'
+		dest='unassigned', help='show only unassigned bugs'
 	)
-
+	parser.add_option(
+		'-c','--categories', action='store_true', 
+		dest='cats', help='show bug category'
+	)
+	parser.add_option(
+		'-l','--link', action='store_true', 
+		dest='links', help='show link to bug details'
+	)
 	options, filter_args = parser.parse_args()
 	unassigned_only = options.unassigned
+	show_cats = options.cats
+	show_links = options.links
 
 	# check if our local copy is recent, if not:
 	# login and download the latest CSV from bugtracker
@@ -133,7 +146,7 @@
 		if PASSWORD == '' :
 			PASSWORD = getpass.getpass('Password: ')
 			
-		data = get_cvs_file(URLLOGIN, URLCSV, USERNAME, PASSWORD)
+		data = get_csv_file(URLLOGIN, URLCSV, USERNAME, PASSWORD)
 		if data:
 			with io.open(LOCALCSV, 'w', encoding='utf8') as f:
 				f.write(data)
@@ -150,12 +163,17 @@
 		if unassigned_only and row[7] != "Nobody" :
 			continue
 		
-		summary = decode_htmlentities(row[11])
+		summary = " "+ decode_htmlentities(row[11])
 		assignee = " -> "+ decode_htmlentities(row[7])
+		category = " " + decode_htmlentities(row[13]) if show_cats else ""
+		link = " \t"+ URLDETAIL + row[0] if show_links else ""
+		
 		if search_re.search(summary) :
 			# highlight the searchstring?
 			if USECOLORS and platform.system() == 'Linux':
 				summary = search_re.sub( "\033[1;33m\g<1>\033[1;m", summary )
 				assignee = "\033[1;30m" +assignee +"\033[1;m"
-			print("#"+ row[0] +" \t"+ summary + assignee)
+				category = "\033[1;30m" + category + "\033[1;m"
+				link = "\033[0;36m" + link + "\033[1;m"
+			print("#"+ row[0] + category + summary + assignee + link)
 




More information about the Bf-extensions-cvs mailing list