[Checkins] SVN: zope.bugchecker/trunk/src/zope/bugchecker/bugchecker.py Allow checker to take project names on the command line.

Tres Seaver tseaver at palladion.com
Wed Apr 14 12:59:49 EDT 2010


Log message for revision 110907:
  Allow checker to take project names on the command line.

Changed:
  U   zope.bugchecker/trunk/src/zope/bugchecker/bugchecker.py

-=-
Modified: zope.bugchecker/trunk/src/zope/bugchecker/bugchecker.py
===================================================================
--- zope.bugchecker/trunk/src/zope/bugchecker/bugchecker.py	2010-04-14 16:59:29 UTC (rev 110906)
+++ zope.bugchecker/trunk/src/zope/bugchecker/bugchecker.py	2010-04-14 16:59:49 UTC (rev 110907)
@@ -1,5 +1,17 @@
-#!/Users/charlieclark/temp/zope/bin/python
 # encoding: utf-8
+##############################################################################
+#
+# Copyright (c) 2010 Zope Foundation and Contributors.
+# All Rights Reserved.
+#
+# This software is subject to the provisions of the Zope Public License,
+# Version 2.1 (ZPL).  A copy of the ZPL should accompany this distribution.
+# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
+# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
+# FOR A PARTICULAR PURPOSE.
+#
+##############################################################################
 """
 bugtracker.py
 
@@ -14,7 +26,6 @@
 N.B. bug_tasks are not the same as bugs.
 
 Created by Charlie Clark on 2010-04-06.
-Copyright (c) 2010 Zope Foundation and Contributors
 """
 
 import datetime
@@ -27,10 +38,12 @@
 class BugTracker(object):
     """Check the BugTracker for new bugs"""
     
-    def __init__(self):
-        """Log into launchpad and get the Zope 3 project"""
+    def __init__(self, project):
+        """Log into launchpad and get the Zope 3 project
+        """
+        self.project = project
         launchpad = Launchpad.login_anonymously("Zope Bugtracker", "edge")
-        self.project = launchpad.projects['zope3']
+        self.project = launchpad.projects[project]
         self.bugs = []
     
     def get(self):
@@ -45,10 +58,20 @@
                 self.bugs.append("%s\n%s" % (bug.title, bug.bug_link))
                 
     def report(self):
-        """Return a printable summary"""
-        return "\n\n".join(self.bugs)
+        """Return a printable summary
+        """
+        lines = ['Languishing bugs for: %s' % self.project]
+        lines.extend(self.bugs)
+        return "\n\n".join(lines)
 
+def main(*projects):
+    if not projects:
+        import sys
+        projects = sys.argv[1:] or ['zope3']
+    for project in projects:
+        Tracker = BugTracker(project)
+        Tracker.get()
+        print Tracker.report()
+
 if __name__ == '__main__':
-    Tracker = BugTracker()
-    Tracker.get()
-    print Tracker.report()
+    main(sys.argv[1:])



More information about the checkins mailing list