annotate scripts/roundup-reminder @ 691:3d8ce8e2dcee search_indexing-0-4-2-branch

[[Metadata associated with this commit was garbled during conversion from CVS to Subversion.]]
author Roche Compaan <rochecompaan@users.sourceforge.net>
date Mon, 15 Apr 2002 23:25:16 +0000
parents
children 54333751e98d 9c76498f1ac3
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
691
3d8ce8e2dcee [[Metadata associated with this commit was garbled during conversion from CVS
Roche Compaan <rochecompaan@users.sourceforge.net>
parents:
diff changeset
1 #! /usr/bin/env python
3d8ce8e2dcee [[Metadata associated with this commit was garbled during conversion from CVS
Roche Compaan <rochecompaan@users.sourceforge.net>
parents:
diff changeset
2 # Copyright (c) 2002 ekit.com Inc (http://www.ekit-inc.com/)
3d8ce8e2dcee [[Metadata associated with this commit was garbled during conversion from CVS
Roche Compaan <rochecompaan@users.sourceforge.net>
parents:
diff changeset
3 #
3d8ce8e2dcee [[Metadata associated with this commit was garbled during conversion from CVS
Roche Compaan <rochecompaan@users.sourceforge.net>
parents:
diff changeset
4 # Permission is hereby granted, free of charge, to any person obtaining a copy
3d8ce8e2dcee [[Metadata associated with this commit was garbled during conversion from CVS
Roche Compaan <rochecompaan@users.sourceforge.net>
parents:
diff changeset
5 # of this software and associated documentation files (the "Software"), to deal
3d8ce8e2dcee [[Metadata associated with this commit was garbled during conversion from CVS
Roche Compaan <rochecompaan@users.sourceforge.net>
parents:
diff changeset
6 # in the Software without restriction, including without limitation the rights
3d8ce8e2dcee [[Metadata associated with this commit was garbled during conversion from CVS
Roche Compaan <rochecompaan@users.sourceforge.net>
parents:
diff changeset
7 # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
3d8ce8e2dcee [[Metadata associated with this commit was garbled during conversion from CVS
Roche Compaan <rochecompaan@users.sourceforge.net>
parents:
diff changeset
8 # copies of the Software, and to permit persons to whom the Software is
3d8ce8e2dcee [[Metadata associated with this commit was garbled during conversion from CVS
Roche Compaan <rochecompaan@users.sourceforge.net>
parents:
diff changeset
9 # furnished to do so, subject to the following conditions:
3d8ce8e2dcee [[Metadata associated with this commit was garbled during conversion from CVS
Roche Compaan <rochecompaan@users.sourceforge.net>
parents:
diff changeset
10 #
3d8ce8e2dcee [[Metadata associated with this commit was garbled during conversion from CVS
Roche Compaan <rochecompaan@users.sourceforge.net>
parents:
diff changeset
11 # The above copyright notice and this permission notice shall be included in
3d8ce8e2dcee [[Metadata associated with this commit was garbled during conversion from CVS
Roche Compaan <rochecompaan@users.sourceforge.net>
parents:
diff changeset
12 # all copies or substantial portions of the Software.
3d8ce8e2dcee [[Metadata associated with this commit was garbled during conversion from CVS
Roche Compaan <rochecompaan@users.sourceforge.net>
parents:
diff changeset
13 #
3d8ce8e2dcee [[Metadata associated with this commit was garbled during conversion from CVS
Roche Compaan <rochecompaan@users.sourceforge.net>
parents:
diff changeset
14 # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
3d8ce8e2dcee [[Metadata associated with this commit was garbled during conversion from CVS
Roche Compaan <rochecompaan@users.sourceforge.net>
parents:
diff changeset
15 # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
3d8ce8e2dcee [[Metadata associated with this commit was garbled during conversion from CVS
Roche Compaan <rochecompaan@users.sourceforge.net>
parents:
diff changeset
16 # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
3d8ce8e2dcee [[Metadata associated with this commit was garbled during conversion from CVS
Roche Compaan <rochecompaan@users.sourceforge.net>
parents:
diff changeset
17 # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
3d8ce8e2dcee [[Metadata associated with this commit was garbled during conversion from CVS
Roche Compaan <rochecompaan@users.sourceforge.net>
parents:
diff changeset
18 # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
3d8ce8e2dcee [[Metadata associated with this commit was garbled during conversion from CVS
Roche Compaan <rochecompaan@users.sourceforge.net>
parents:
diff changeset
19 # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
3d8ce8e2dcee [[Metadata associated with this commit was garbled during conversion from CVS
Roche Compaan <rochecompaan@users.sourceforge.net>
parents:
diff changeset
20 # SOFTWARE.
3d8ce8e2dcee [[Metadata associated with this commit was garbled during conversion from CVS
Roche Compaan <rochecompaan@users.sourceforge.net>
parents:
diff changeset
21
3d8ce8e2dcee [[Metadata associated with this commit was garbled during conversion from CVS
Roche Compaan <rochecompaan@users.sourceforge.net>
parents:
diff changeset
22 # $Id: roundup-reminder,v 1.1 2002-04-15 06:37:31 richard Exp $
3d8ce8e2dcee [[Metadata associated with this commit was garbled during conversion from CVS
Roche Compaan <rochecompaan@users.sourceforge.net>
parents:
diff changeset
23
3d8ce8e2dcee [[Metadata associated with this commit was garbled during conversion from CVS
Roche Compaan <rochecompaan@users.sourceforge.net>
parents:
diff changeset
24 '''
3d8ce8e2dcee [[Metadata associated with this commit was garbled during conversion from CVS
Roche Compaan <rochecompaan@users.sourceforge.net>
parents:
diff changeset
25 Simple script that emails all users of a tracker with the issues that
3d8ce8e2dcee [[Metadata associated with this commit was garbled during conversion from CVS
Roche Compaan <rochecompaan@users.sourceforge.net>
parents:
diff changeset
26 are currently assigned to them.
3d8ce8e2dcee [[Metadata associated with this commit was garbled during conversion from CVS
Roche Compaan <rochecompaan@users.sourceforge.net>
parents:
diff changeset
27
3d8ce8e2dcee [[Metadata associated with this commit was garbled during conversion from CVS
Roche Compaan <rochecompaan@users.sourceforge.net>
parents:
diff changeset
28 TODO: introduce some structure ;)
3d8ce8e2dcee [[Metadata associated with this commit was garbled during conversion from CVS
Roche Compaan <rochecompaan@users.sourceforge.net>
parents:
diff changeset
29 TODO: possibly make this more general and configurable...
3d8ce8e2dcee [[Metadata associated with this commit was garbled during conversion from CVS
Roche Compaan <rochecompaan@users.sourceforge.net>
parents:
diff changeset
30
3d8ce8e2dcee [[Metadata associated with this commit was garbled during conversion from CVS
Roche Compaan <rochecompaan@users.sourceforge.net>
parents:
diff changeset
31 Note: The instance that this script was designed for has a modified schema!
3d8ce8e2dcee [[Metadata associated with this commit was garbled during conversion from CVS
Roche Compaan <rochecompaan@users.sourceforge.net>
parents:
diff changeset
32 You will want to modify this script to customise it for your own schema!
3d8ce8e2dcee [[Metadata associated with this commit was garbled during conversion from CVS
Roche Compaan <rochecompaan@users.sourceforge.net>
parents:
diff changeset
33 '''
3d8ce8e2dcee [[Metadata associated with this commit was garbled during conversion from CVS
Roche Compaan <rochecompaan@users.sourceforge.net>
parents:
diff changeset
34
3d8ce8e2dcee [[Metadata associated with this commit was garbled during conversion from CVS
Roche Compaan <rochecompaan@users.sourceforge.net>
parents:
diff changeset
35 import cStringIO, MimeWriter, smtplib
3d8ce8e2dcee [[Metadata associated with this commit was garbled during conversion from CVS
Roche Compaan <rochecompaan@users.sourceforge.net>
parents:
diff changeset
36 from roundup import instance, date
3d8ce8e2dcee [[Metadata associated with this commit was garbled during conversion from CVS
Roche Compaan <rochecompaan@users.sourceforge.net>
parents:
diff changeset
37
3d8ce8e2dcee [[Metadata associated with this commit was garbled during conversion from CVS
Roche Compaan <rochecompaan@users.sourceforge.net>
parents:
diff changeset
38 # open the instance
3d8ce8e2dcee [[Metadata associated with this commit was garbled during conversion from CVS
Roche Compaan <rochecompaan@users.sourceforge.net>
parents:
diff changeset
39 if len(sys.argv) != 2:
3d8ce8e2dcee [[Metadata associated with this commit was garbled during conversion from CVS
Roche Compaan <rochecompaan@users.sourceforge.net>
parents:
diff changeset
40 print 'You need to specify an instance home dir'
3d8ce8e2dcee [[Metadata associated with this commit was garbled during conversion from CVS
Roche Compaan <rochecompaan@users.sourceforge.net>
parents:
diff changeset
41 instance_home = sys.argv[1]
3d8ce8e2dcee [[Metadata associated with this commit was garbled during conversion from CVS
Roche Compaan <rochecompaan@users.sourceforge.net>
parents:
diff changeset
42 instance = instance.open(instance_home)
3d8ce8e2dcee [[Metadata associated with this commit was garbled during conversion from CVS
Roche Compaan <rochecompaan@users.sourceforge.net>
parents:
diff changeset
43 db = instance.open('admin')
3d8ce8e2dcee [[Metadata associated with this commit was garbled during conversion from CVS
Roche Compaan <rochecompaan@users.sourceforge.net>
parents:
diff changeset
44
3d8ce8e2dcee [[Metadata associated with this commit was garbled during conversion from CVS
Roche Compaan <rochecompaan@users.sourceforge.net>
parents:
diff changeset
45 resolved_id = db.status.lookup('resolved')
3d8ce8e2dcee [[Metadata associated with this commit was garbled during conversion from CVS
Roche Compaan <rochecompaan@users.sourceforge.net>
parents:
diff changeset
46
3d8ce8e2dcee [[Metadata associated with this commit was garbled during conversion from CVS
Roche Compaan <rochecompaan@users.sourceforge.net>
parents:
diff changeset
47 # loop through all the users
3d8ce8e2dcee [[Metadata associated with this commit was garbled during conversion from CVS
Roche Compaan <rochecompaan@users.sourceforge.net>
parents:
diff changeset
48 for user_id in db.user.list():
3d8ce8e2dcee [[Metadata associated with this commit was garbled during conversion from CVS
Roche Compaan <rochecompaan@users.sourceforge.net>
parents:
diff changeset
49 # make sure we care aboue this user
3d8ce8e2dcee [[Metadata associated with this commit was garbled during conversion from CVS
Roche Compaan <rochecompaan@users.sourceforge.net>
parents:
diff changeset
50 name = db.user.get(user_id, 'realname')
3d8ce8e2dcee [[Metadata associated with this commit was garbled during conversion from CVS
Roche Compaan <rochecompaan@users.sourceforge.net>
parents:
diff changeset
51 if name is None:
3d8ce8e2dcee [[Metadata associated with this commit was garbled during conversion from CVS
Roche Compaan <rochecompaan@users.sourceforge.net>
parents:
diff changeset
52 name = db.user.get(user_id, 'username')
3d8ce8e2dcee [[Metadata associated with this commit was garbled during conversion from CVS
Roche Compaan <rochecompaan@users.sourceforge.net>
parents:
diff changeset
53 address = db.user.get(user_id, 'address')
3d8ce8e2dcee [[Metadata associated with this commit was garbled during conversion from CVS
Roche Compaan <rochecompaan@users.sourceforge.net>
parents:
diff changeset
54 if address is None:
3d8ce8e2dcee [[Metadata associated with this commit was garbled during conversion from CVS
Roche Compaan <rochecompaan@users.sourceforge.net>
parents:
diff changeset
55 continue
3d8ce8e2dcee [[Metadata associated with this commit was garbled during conversion from CVS
Roche Compaan <rochecompaan@users.sourceforge.net>
parents:
diff changeset
56
3d8ce8e2dcee [[Metadata associated with this commit was garbled during conversion from CVS
Roche Compaan <rochecompaan@users.sourceforge.net>
parents:
diff changeset
57 # extract this user's issues
3d8ce8e2dcee [[Metadata associated with this commit was garbled during conversion from CVS
Roche Compaan <rochecompaan@users.sourceforge.net>
parents:
diff changeset
58 l = []
3d8ce8e2dcee [[Metadata associated with this commit was garbled during conversion from CVS
Roche Compaan <rochecompaan@users.sourceforge.net>
parents:
diff changeset
59 for issue_id in db.issue.find(assignedto=user_id):
3d8ce8e2dcee [[Metadata associated with this commit was garbled during conversion from CVS
Roche Compaan <rochecompaan@users.sourceforge.net>
parents:
diff changeset
60 if db.issue.get(issue_id, 'status') == resolved_id: continue
3d8ce8e2dcee [[Metadata associated with this commit was garbled during conversion from CVS
Roche Compaan <rochecompaan@users.sourceforge.net>
parents:
diff changeset
61 timeliness_id = db.issue.get(issue_id, 'timeliness')
3d8ce8e2dcee [[Metadata associated with this commit was garbled during conversion from CVS
Roche Compaan <rochecompaan@users.sourceforge.net>
parents:
diff changeset
62 if timeliness_id:
3d8ce8e2dcee [[Metadata associated with this commit was garbled during conversion from CVS
Roche Compaan <rochecompaan@users.sourceforge.net>
parents:
diff changeset
63 timeliness = db.timeliness.get(timeliness_id, 'name')
3d8ce8e2dcee [[Metadata associated with this commit was garbled during conversion from CVS
Roche Compaan <rochecompaan@users.sourceforge.net>
parents:
diff changeset
64 else:
3d8ce8e2dcee [[Metadata associated with this commit was garbled during conversion from CVS
Roche Compaan <rochecompaan@users.sourceforge.net>
parents:
diff changeset
65 timeliness = '~~~'
3d8ce8e2dcee [[Metadata associated with this commit was garbled during conversion from CVS
Roche Compaan <rochecompaan@users.sourceforge.net>
parents:
diff changeset
66 l.append((timeliness, db.issue.get(issue_id, 'creation'), issue_id))
3d8ce8e2dcee [[Metadata associated with this commit was garbled during conversion from CVS
Roche Compaan <rochecompaan@users.sourceforge.net>
parents:
diff changeset
67
3d8ce8e2dcee [[Metadata associated with this commit was garbled during conversion from CVS
Roche Compaan <rochecompaan@users.sourceforge.net>
parents:
diff changeset
68 # sort the issues by timeliness and creation date
3d8ce8e2dcee [[Metadata associated with this commit was garbled during conversion from CVS
Roche Compaan <rochecompaan@users.sourceforge.net>
parents:
diff changeset
69 l.sort()
3d8ce8e2dcee [[Metadata associated with this commit was garbled during conversion from CVS
Roche Compaan <rochecompaan@users.sourceforge.net>
parents:
diff changeset
70 if not l:
3d8ce8e2dcee [[Metadata associated with this commit was garbled during conversion from CVS
Roche Compaan <rochecompaan@users.sourceforge.net>
parents:
diff changeset
71 continue
3d8ce8e2dcee [[Metadata associated with this commit was garbled during conversion from CVS
Roche Compaan <rochecompaan@users.sourceforge.net>
parents:
diff changeset
72
3d8ce8e2dcee [[Metadata associated with this commit was garbled during conversion from CVS
Roche Compaan <rochecompaan@users.sourceforge.net>
parents:
diff changeset
73 # generate the email message
3d8ce8e2dcee [[Metadata associated with this commit was garbled during conversion from CVS
Roche Compaan <rochecompaan@users.sourceforge.net>
parents:
diff changeset
74 message = cStringIO.StringIO()
3d8ce8e2dcee [[Metadata associated with this commit was garbled during conversion from CVS
Roche Compaan <rochecompaan@users.sourceforge.net>
parents:
diff changeset
75 writer = MimeWriter.MimeWriter(message)
3d8ce8e2dcee [[Metadata associated with this commit was garbled during conversion from CVS
Roche Compaan <rochecompaan@users.sourceforge.net>
parents:
diff changeset
76 writer.addheader('Subject', 'Your active %s issues'%db.config.INSTANCE_NAME)
3d8ce8e2dcee [[Metadata associated with this commit was garbled during conversion from CVS
Roche Compaan <rochecompaan@users.sourceforge.net>
parents:
diff changeset
77 writer.addheader('To', address)
3d8ce8e2dcee [[Metadata associated with this commit was garbled during conversion from CVS
Roche Compaan <rochecompaan@users.sourceforge.net>
parents:
diff changeset
78 writer.addheader('From', '%s <%s>'%(db.config.INSTANCE_NAME,
3d8ce8e2dcee [[Metadata associated with this commit was garbled during conversion from CVS
Roche Compaan <rochecompaan@users.sourceforge.net>
parents:
diff changeset
79 db.config.ADMIN_EMAIL))
3d8ce8e2dcee [[Metadata associated with this commit was garbled during conversion from CVS
Roche Compaan <rochecompaan@users.sourceforge.net>
parents:
diff changeset
80 writer.addheader('Reply-To', '%s <%s>'%(db.config.INSTANCE_NAME,
3d8ce8e2dcee [[Metadata associated with this commit was garbled during conversion from CVS
Roche Compaan <rochecompaan@users.sourceforge.net>
parents:
diff changeset
81 db.config.ADMIN_EMAIL))
3d8ce8e2dcee [[Metadata associated with this commit was garbled during conversion from CVS
Roche Compaan <rochecompaan@users.sourceforge.net>
parents:
diff changeset
82 writer.addheader('MIME-Version', '1.0')
3d8ce8e2dcee [[Metadata associated with this commit was garbled during conversion from CVS
Roche Compaan <rochecompaan@users.sourceforge.net>
parents:
diff changeset
83 writer.addheader('X-Roundup-Name', db.config.INSTANCE_NAME)
3d8ce8e2dcee [[Metadata associated with this commit was garbled during conversion from CVS
Roche Compaan <rochecompaan@users.sourceforge.net>
parents:
diff changeset
84
3d8ce8e2dcee [[Metadata associated with this commit was garbled during conversion from CVS
Roche Compaan <rochecompaan@users.sourceforge.net>
parents:
diff changeset
85 # start the multipart
3d8ce8e2dcee [[Metadata associated with this commit was garbled during conversion from CVS
Roche Compaan <rochecompaan@users.sourceforge.net>
parents:
diff changeset
86 part = writer.startmultipartbody('alternative')
3d8ce8e2dcee [[Metadata associated with this commit was garbled during conversion from CVS
Roche Compaan <rochecompaan@users.sourceforge.net>
parents:
diff changeset
87 part = writer.nextpart()
3d8ce8e2dcee [[Metadata associated with this commit was garbled during conversion from CVS
Roche Compaan <rochecompaan@users.sourceforge.net>
parents:
diff changeset
88 body = part.startbody('text/plain')
3d8ce8e2dcee [[Metadata associated with this commit was garbled during conversion from CVS
Roche Compaan <rochecompaan@users.sourceforge.net>
parents:
diff changeset
89
3d8ce8e2dcee [[Metadata associated with this commit was garbled during conversion from CVS
Roche Compaan <rochecompaan@users.sourceforge.net>
parents:
diff changeset
90 # do the plain text bit
3d8ce8e2dcee [[Metadata associated with this commit was garbled during conversion from CVS
Roche Compaan <rochecompaan@users.sourceforge.net>
parents:
diff changeset
91 print >>body, 'Created ID Urgency Title'
3d8ce8e2dcee [[Metadata associated with this commit was garbled during conversion from CVS
Roche Compaan <rochecompaan@users.sourceforge.net>
parents:
diff changeset
92 print >>body, '='*75
3d8ce8e2dcee [[Metadata associated with this commit was garbled during conversion from CVS
Roche Compaan <rochecompaan@users.sourceforge.net>
parents:
diff changeset
93 # '2 months 213 immediate cc_daemon barfage
3d8ce8e2dcee [[Metadata associated with this commit was garbled during conversion from CVS
Roche Compaan <rochecompaan@users.sourceforge.net>
parents:
diff changeset
94 for timeliness, creation_date, issue_id in l:
3d8ce8e2dcee [[Metadata associated with this commit was garbled during conversion from CVS
Roche Compaan <rochecompaan@users.sourceforge.net>
parents:
diff changeset
95 # pretty creation
3d8ce8e2dcee [[Metadata associated with this commit was garbled during conversion from CVS
Roche Compaan <rochecompaan@users.sourceforge.net>
parents:
diff changeset
96 creation = (date.Date('.') - creation_date).pretty()
3d8ce8e2dcee [[Metadata associated with this commit was garbled during conversion from CVS
Roche Compaan <rochecompaan@users.sourceforge.net>
parents:
diff changeset
97 if creation is None:
3d8ce8e2dcee [[Metadata associated with this commit was garbled during conversion from CVS
Roche Compaan <rochecompaan@users.sourceforge.net>
parents:
diff changeset
98 creation = creation_date.pretty()
3d8ce8e2dcee [[Metadata associated with this commit was garbled during conversion from CVS
Roche Compaan <rochecompaan@users.sourceforge.net>
parents:
diff changeset
99
3d8ce8e2dcee [[Metadata associated with this commit was garbled during conversion from CVS
Roche Compaan <rochecompaan@users.sourceforge.net>
parents:
diff changeset
100 if not timeliness: timeliness = ''
3d8ce8e2dcee [[Metadata associated with this commit was garbled during conversion from CVS
Roche Compaan <rochecompaan@users.sourceforge.net>
parents:
diff changeset
101 title = db.issue.get(issue_id, 'title')
3d8ce8e2dcee [[Metadata associated with this commit was garbled during conversion from CVS
Roche Compaan <rochecompaan@users.sourceforge.net>
parents:
diff changeset
102 if len(title) > 52: title = title[:48] + ' ...'
3d8ce8e2dcee [[Metadata associated with this commit was garbled during conversion from CVS
Roche Compaan <rochecompaan@users.sourceforge.net>
parents:
diff changeset
103 print >>body, '%-11s %-4s %-9s %-52s'%(creation, issue_id,
3d8ce8e2dcee [[Metadata associated with this commit was garbled during conversion from CVS
Roche Compaan <rochecompaan@users.sourceforge.net>
parents:
diff changeset
104 timeliness, title)
3d8ce8e2dcee [[Metadata associated with this commit was garbled during conversion from CVS
Roche Compaan <rochecompaan@users.sourceforge.net>
parents:
diff changeset
105
3d8ce8e2dcee [[Metadata associated with this commit was garbled during conversion from CVS
Roche Compaan <rochecompaan@users.sourceforge.net>
parents:
diff changeset
106 # now the HTML one
3d8ce8e2dcee [[Metadata associated with this commit was garbled during conversion from CVS
Roche Compaan <rochecompaan@users.sourceforge.net>
parents:
diff changeset
107 part = writer.nextpart()
3d8ce8e2dcee [[Metadata associated with this commit was garbled during conversion from CVS
Roche Compaan <rochecompaan@users.sourceforge.net>
parents:
diff changeset
108 body = part.startbody('text/html')
3d8ce8e2dcee [[Metadata associated with this commit was garbled during conversion from CVS
Roche Compaan <rochecompaan@users.sourceforge.net>
parents:
diff changeset
109 colours = {
3d8ce8e2dcee [[Metadata associated with this commit was garbled during conversion from CVS
Roche Compaan <rochecompaan@users.sourceforge.net>
parents:
diff changeset
110 'immediate': ' bgcolor="#ffcdcd"',
3d8ce8e2dcee [[Metadata associated with this commit was garbled during conversion from CVS
Roche Compaan <rochecompaan@users.sourceforge.net>
parents:
diff changeset
111 'day': ' bgcolor="#ffdecd"',
3d8ce8e2dcee [[Metadata associated with this commit was garbled during conversion from CVS
Roche Compaan <rochecompaan@users.sourceforge.net>
parents:
diff changeset
112 'week': ' bgcolor="#ffeecd"',
3d8ce8e2dcee [[Metadata associated with this commit was garbled during conversion from CVS
Roche Compaan <rochecompaan@users.sourceforge.net>
parents:
diff changeset
113 'month': ' bgcolor="#ffffcd"',
3d8ce8e2dcee [[Metadata associated with this commit was garbled during conversion from CVS
Roche Compaan <rochecompaan@users.sourceforge.net>
parents:
diff changeset
114 'whenever': ' bgcolor="#ffffff"',
3d8ce8e2dcee [[Metadata associated with this commit was garbled during conversion from CVS
Roche Compaan <rochecompaan@users.sourceforge.net>
parents:
diff changeset
115 }
3d8ce8e2dcee [[Metadata associated with this commit was garbled during conversion from CVS
Roche Compaan <rochecompaan@users.sourceforge.net>
parents:
diff changeset
116 print >>body, '''<table border>
3d8ce8e2dcee [[Metadata associated with this commit was garbled during conversion from CVS
Roche Compaan <rochecompaan@users.sourceforge.net>
parents:
diff changeset
117 <tr><th>Created</th> <th>ID</th> <th>Urgency</th> <th>Title</th></tr>
3d8ce8e2dcee [[Metadata associated with this commit was garbled during conversion from CVS
Roche Compaan <rochecompaan@users.sourceforge.net>
parents:
diff changeset
118 '''
3d8ce8e2dcee [[Metadata associated with this commit was garbled during conversion from CVS
Roche Compaan <rochecompaan@users.sourceforge.net>
parents:
diff changeset
119 for timeliness, creation_date, issue_id in l:
3d8ce8e2dcee [[Metadata associated with this commit was garbled during conversion from CVS
Roche Compaan <rochecompaan@users.sourceforge.net>
parents:
diff changeset
120 creation = (date.Date('.') - creation_date).pretty()
3d8ce8e2dcee [[Metadata associated with this commit was garbled during conversion from CVS
Roche Compaan <rochecompaan@users.sourceforge.net>
parents:
diff changeset
121 if creation is None:
3d8ce8e2dcee [[Metadata associated with this commit was garbled during conversion from CVS
Roche Compaan <rochecompaan@users.sourceforge.net>
parents:
diff changeset
122 creation = creation_date.pretty()
3d8ce8e2dcee [[Metadata associated with this commit was garbled during conversion from CVS
Roche Compaan <rochecompaan@users.sourceforge.net>
parents:
diff changeset
123 if not timeliness_id: timeliness_id = ' '
3d8ce8e2dcee [[Metadata associated with this commit was garbled during conversion from CVS
Roche Compaan <rochecompaan@users.sourceforge.net>
parents:
diff changeset
124 title = db.issue.get(issue_id, 'title')
3d8ce8e2dcee [[Metadata associated with this commit was garbled during conversion from CVS
Roche Compaan <rochecompaan@users.sourceforge.net>
parents:
diff changeset
125 issue_id = '<a href="%sissue%s">%s</a>'%(db.config.ISSUE_TRACKER_WEB,
3d8ce8e2dcee [[Metadata associated with this commit was garbled during conversion from CVS
Roche Compaan <rochecompaan@users.sourceforge.net>
parents:
diff changeset
126 issue_id, issue_id)
3d8ce8e2dcee [[Metadata associated with this commit was garbled during conversion from CVS
Roche Compaan <rochecompaan@users.sourceforge.net>
parents:
diff changeset
127 colour = colours.get(timeliness, '')
3d8ce8e2dcee [[Metadata associated with this commit was garbled during conversion from CVS
Roche Compaan <rochecompaan@users.sourceforge.net>
parents:
diff changeset
128 print >>body, '''<tr%s><td>%s</td><td>%s</td><td>%s</td>
3d8ce8e2dcee [[Metadata associated with this commit was garbled during conversion from CVS
Roche Compaan <rochecompaan@users.sourceforge.net>
parents:
diff changeset
129 <td>%s</td></tr>'''%(colour, creation, issue_id, timeliness, title)
3d8ce8e2dcee [[Metadata associated with this commit was garbled during conversion from CVS
Roche Compaan <rochecompaan@users.sourceforge.net>
parents:
diff changeset
130 print >>body, '</table>'
3d8ce8e2dcee [[Metadata associated with this commit was garbled during conversion from CVS
Roche Compaan <rochecompaan@users.sourceforge.net>
parents:
diff changeset
131
3d8ce8e2dcee [[Metadata associated with this commit was garbled during conversion from CVS
Roche Compaan <rochecompaan@users.sourceforge.net>
parents:
diff changeset
132 # finish of the multipart
3d8ce8e2dcee [[Metadata associated with this commit was garbled during conversion from CVS
Roche Compaan <rochecompaan@users.sourceforge.net>
parents:
diff changeset
133 writer.lastpart()
3d8ce8e2dcee [[Metadata associated with this commit was garbled during conversion from CVS
Roche Compaan <rochecompaan@users.sourceforge.net>
parents:
diff changeset
134
3d8ce8e2dcee [[Metadata associated with this commit was garbled during conversion from CVS
Roche Compaan <rochecompaan@users.sourceforge.net>
parents:
diff changeset
135 # all done, send!
3d8ce8e2dcee [[Metadata associated with this commit was garbled during conversion from CVS
Roche Compaan <rochecompaan@users.sourceforge.net>
parents:
diff changeset
136 smtp = smtplib.SMTP(db.config.MAILHOST)
3d8ce8e2dcee [[Metadata associated with this commit was garbled during conversion from CVS
Roche Compaan <rochecompaan@users.sourceforge.net>
parents:
diff changeset
137 smtp.sendmail(db.config.ADMIN_EMAIL, address, message.getvalue())
3d8ce8e2dcee [[Metadata associated with this commit was garbled during conversion from CVS
Roche Compaan <rochecompaan@users.sourceforge.net>
parents:
diff changeset
138
3d8ce8e2dcee [[Metadata associated with this commit was garbled during conversion from CVS
Roche Compaan <rochecompaan@users.sourceforge.net>
parents:
diff changeset
139 #
3d8ce8e2dcee [[Metadata associated with this commit was garbled during conversion from CVS
Roche Compaan <rochecompaan@users.sourceforge.net>
parents:
diff changeset
140 # $Log: not supported by cvs2svn $
3d8ce8e2dcee [[Metadata associated with this commit was garbled during conversion from CVS
Roche Compaan <rochecompaan@users.sourceforge.net>
parents:
diff changeset
141 #
3d8ce8e2dcee [[Metadata associated with this commit was garbled during conversion from CVS
Roche Compaan <rochecompaan@users.sourceforge.net>
parents:
diff changeset
142 #

Roundup Issue Tracker: http://roundup-tracker.org/