Code

Allow to specify additional cc and bcc emails (not roundup users) for
[roundup.git] / scripts / roundup-reminder
index a4db8fce3a9e02806291db3b0cdaf4cbc4f5e30a..38ed9c34b2874624122396dfb7646d261cff6832 100755 (executable)
@@ -1,4 +1,4 @@
-#! /usr/bin/env python2.2
+#! /usr/bin/env python
 # Copyright (c) 2002 ekit.com Inc (http://www.ekit-inc.com/)
 #
 # Permission is hereby granted, free of charge, to any person obtaining a copy
@@ -19,8 +19,6 @@
 # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
 # SOFTWARE.
 
-# $Id: roundup-reminder,v 1.7 2004-02-11 00:00:01 richard Exp $
-
 '''
 Simple script that emails all users of a tracker with the issues that
 are currently assigned to them.
@@ -31,7 +29,7 @@ TODO: possibly make this more general and configurable...
 
 import sys, cStringIO, MimeWriter, smtplib
 from roundup import instance, date
-from roundup.mailgw import openSMTPConnection
+from roundup.mailer import SMTPConnection
 
 # open the instance
 if len(sys.argv) != 2:
@@ -96,7 +94,7 @@ for user_id in db.user.list():
     body = part.startbody('text/plain')
     
     # do the plain text bit
-    print >>body, 'Created     ID   Urgency   Title'
+    print >>body, 'Created     ID   Activity  Title'
     print >>body, '='*75
     #             '2 months    213  immediate cc_daemon barfage
     old_priority = None
@@ -106,10 +104,10 @@ for user_id in db.user.list():
             old_priority = priority
             print >>body, '    ', db.priority.get(priority,'name')
         # pretty creation
-        creation = (date.Date('.') - creation_date).pretty()
+        creation = (creation_date - date.Date('.')).pretty()
         if creation is None:
             creation = creation_date.pretty()
-        activity = (date.Date('.') - activity_date).pretty()
+        activity = (activity_date - date.Date('.')).pretty()
         title = db.issue.get(issue_id, 'title')
         if len(title) > 42:
             title = title[:38] + ' ...'
@@ -147,11 +145,11 @@ and click on "My Issues". Do NOT respond to this message.
            print >>body, '<tr><td>-></td><td>-></td><td>-></td><td><b>%s</b></td></tr>'%db.priority.get(priority,'name')
         creation = (date.Date('.') - creation_date).pretty()
         if creation is None:
-            creation = creation_date.pretty()
+            creation = (creation_date - date.Date('.')).pretty()
         title = db.issue.get(issue_id, 'title')
         issue_id = '<a href="%sissue%s">%s</a>'%(db.config.TRACKER_WEB,
             issue_id, issue_id)
-        activity = (date.Date('.') - activity_date).pretty()
+        activity = (activity_date - date.Date('.')).pretty()
         print >>body, '''<tr><td>%s</td><td>%s</td><td>%s</td>
     <td>%s</td></tr>'''%(creation, issue_id, activity, title)
     print >>body, '</table>'
@@ -164,7 +162,7 @@ and click on "My Issues". Do NOT respond to this message.
     writer.lastpart()
 
     # all done, send!
-    smtp = openSMTPConnection(db.config)
+    smtp = SMTPConnection(db.config)
     smtp.sendmail(db.config.ADMIN_EMAIL, address, message.getvalue())
 
 # vim: set filetype=python ts=4 sw=4 et si