[Checkins] SVN: z3c.testsummarizer/trunk/src/z3c/testsummarizer/main.py Remove configuration and debugging, those need to be restructured

Wolfgang Schnerring wosc at wosc.de
Wed Mar 30 12:32:48 EDT 2011


Log message for revision 121169:
  Remove configuration and debugging, those need to be restructured
  

Changed:
  U   z3c.testsummarizer/trunk/src/z3c/testsummarizer/main.py

-=-
Modified: z3c.testsummarizer/trunk/src/z3c/testsummarizer/main.py
===================================================================
--- z3c.testsummarizer/trunk/src/z3c/testsummarizer/main.py	2011-03-30 16:19:06 UTC (rev 121168)
+++ z3c.testsummarizer/trunk/src/z3c/testsummarizer/main.py	2011-03-30 16:32:48 UTC (rev 121169)
@@ -26,17 +26,14 @@
 
 
 # Settings used by the script. You'll want to customize some of these.
-# archive_url = 'http://mail.zope.org/pipermail/zope-tests/'
-archive_url = 'file:///tmp/mail.zope.org/pipermail/zope-tests/'
+archive_url = 'https://mail.zope.org/pipermail/zope-tests/'
+list_name='zope-tests'
+subject_prefix='Zope Tests'
 
 mailfrom = 'Zope tests summarizer <ct+zopetests at gocept.com>'
 mailto = 'zope-dev list <zope-dev at zope.org>'
-smtpserver = 'mail.gocept.net'
-debug_mailto = 'ct at gocept.com'
+smtpserver = 'localhost'
 
-# used when debugging
-print_not_email = False
-
 months = ("January February March April May June July August September "
           "October November December").split()
 
@@ -153,41 +150,22 @@
     Get the list of URLs, get the appropriate messages, compose an email,
     send it to the mailing list.
     """
-    usage = 'Usage: list_summarizer.py -C zope|cmf|plone [-T isodate] [-D]'
-    selected_config = ''
+    usage = 'Usage: test-summarizer [-T isodate]'
     selected_date = ''
-    debug_mode = 0
 
     try:
-        options, arg = getopt.getopt(argv, 'hC:T:D')
+        options, arg = getopt.getopt(argv, 'hT:')
     except getopt.GetoptError, e:
         err_exit('%s\n%s' % (e.msg, usage))
 
     for name, value in options:
-        if name == '-C':
-            selected_config = value.strip()+'_summarizer'
-        elif name == '-T':
+        if name == '-T':
             selected_date = value.strip()
-        elif name == '-D':
-            debug_mode = 1
         elif name == '-h':
             err_exit(usage, 0)
         else:
             err_exit(usage)
 
-    configs = {'zope_summarizer': dict(list_name='zope-tests',
-                                       subject_prefix='Zope Tests')}
-
-    if not selected_config in configs:
-        err_exit(usage)
-
-    config = configs[selected_config]
-    globals().update(config)
-
-    if debug_mode:
-        global mailto
-        mailto = debug_mailto
-
     # All dates used are naive dates (no explicit tz).
     now = datetime.datetime.utcnow()
     now = now.replace(second=0)
@@ -270,21 +248,12 @@
     subject = '%s - %s' % (subject_prefix, ', '.join('%s: %s' % x for x in
                                                      sorted(stats.items())))
 
-    if print_not_email:
-        print "Not sending this email."
-        print
-        print "Subject:", subject
-        print "From:", mailfrom
-        print "To:", mailto
-        print
-        print out.getvalue()
-    else:
-        body = "From: %s\nTo: %s\nSubject: %s\n\n%s" % (
-            mailfrom, mailto, subject, out.getvalue())
+    body = "From: %s\nTo: %s\nSubject: %s\n\n%s" % (
+        mailfrom, mailto, subject, out.getvalue())
 
-        fromname, fromaddr = parseaddr(mailfrom)
-        toname, toaddr = parseaddr(mailto)
+    fromname, fromaddr = parseaddr(mailfrom)
+    toname, toaddr = parseaddr(mailto)
 
-        s = smtplib.SMTP(smtpserver, 25)
-        s.sendmail(fromaddr, toaddr, body)
-        s.quit()
+    s = smtplib.SMTP(smtpserver, 25)
+    s.sendmail(fromaddr, toaddr, body)
+    s.quit()



More information about the checkins mailing list