Mercurial > p > roundup > code
comparison roundup/roundupdb.py @ 308:e32af1eff4ea
Added author identification to e-mail messages from roundup.
| author | Richard Jones <richard@users.sourceforge.net> |
|---|---|
| date | Sun, 21 Oct 2001 00:45:15 +0000 |
| parents | e13d55912cd4 |
| children | 489b70c37f32 |
comparison
equal
deleted
inserted
replaced
| 307:dac78e092228 | 308:e32af1eff4ea |
|---|---|
| 13 # BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS | 13 # BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS |
| 14 # FOR A PARTICULAR PURPOSE. THE CODE PROVIDED HEREUNDER IS ON AN "AS IS" | 14 # FOR A PARTICULAR PURPOSE. THE CODE PROVIDED HEREUNDER IS ON AN "AS IS" |
| 15 # BASIS, AND THERE IS NO OBLIGATION WHATSOEVER TO PROVIDE MAINTENANCE, | 15 # BASIS, AND THERE IS NO OBLIGATION WHATSOEVER TO PROVIDE MAINTENANCE, |
| 16 # SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. | 16 # SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. |
| 17 # | 17 # |
| 18 # $Id: roundupdb.py,v 1.12 2001-10-04 02:16:15 richard Exp $ | 18 # $Id: roundupdb.py,v 1.13 2001-10-21 00:45:15 richard Exp $ |
| 19 | 19 |
| 20 import re, os, smtplib, socket | 20 import re, os, smtplib, socket |
| 21 | 21 |
| 22 import hyperdb, date | 22 import hyperdb, date |
| 23 | 23 |
| 260 | 260 |
| 261 # send an email to the people who missed out | 261 # send an email to the people who missed out |
| 262 sendto = [self.db.user.get(i, 'address') for i in recipients] | 262 sendto = [self.db.user.get(i, 'address') for i in recipients] |
| 263 cn = self.classname | 263 cn = self.classname |
| 264 title = self.get(nodeid, 'title') or '%s message copy'%cn | 264 title = self.get(nodeid, 'title') or '%s message copy'%cn |
| 265 # figure author information | |
| 266 authname = self.db.user.get(authid, 'realname') | |
| 267 if not authname: | |
| 268 authname = self.db.user.get(authid, 'username') | |
| 269 authaddr = self.db.user.get(authid, 'address') | |
| 270 if authaddr: | |
| 271 authaddr = '<%s> '%authaddr | |
| 272 else: | |
| 273 authaddr = '' | |
| 274 # TODO attachments | |
| 265 m = ['Subject: [%s%s] %s'%(cn, nodeid, title)] | 275 m = ['Subject: [%s%s] %s'%(cn, nodeid, title)] |
| 266 m.append('To: %s'%', '.join(sendto)) | 276 m.append('To: %s'%', '.join(sendto)) |
| 267 m.append('Reply-To: %s'%self.ISSUE_TRACKER_EMAIL) | 277 m.append('Reply-To: %s'%self.ISSUE_TRACKER_EMAIL) |
| 268 m.append('') | 278 m.append('') |
| 279 # add author information | |
| 280 m.append("%s %sadded the comment:"%(authname, authaddr)) | |
| 281 m.append('') | |
| 282 # add the content | |
| 269 m.append(self.db.msg.get(msgid, 'content')) | 283 m.append(self.db.msg.get(msgid, 'content')) |
| 284 # "list information" footer | |
| 270 m.append(self.email_footer(nodeid, msgid)) | 285 m.append(self.email_footer(nodeid, msgid)) |
| 271 # TODO attachments | |
| 272 try: | 286 try: |
| 273 smtp = smtplib.SMTP(self.MAILHOST) | 287 smtp = smtplib.SMTP(self.MAILHOST) |
| 274 smtp.sendmail(self.ISSUE_TRACKER_EMAIL, sendto, '\n'.join(m)) | 288 smtp.sendmail(self.ISSUE_TRACKER_EMAIL, sendto, '\n'.join(m)) |
| 275 except socket.error, value: | 289 except socket.error, value: |
| 276 return "Couldn't send confirmation email: mailhost %s"%value | 290 return "Couldn't send confirmation email: mailhost %s"%value |
| 287 %s | 301 %s |
| 288 '''%('_'*len(web), self.ISSUE_TRACKER_EMAIL, web) | 302 '''%('_'*len(web), self.ISSUE_TRACKER_EMAIL, web) |
| 289 | 303 |
| 290 # | 304 # |
| 291 # $Log: not supported by cvs2svn $ | 305 # $Log: not supported by cvs2svn $ |
| 306 # Revision 1.12 2001/10/04 02:16:15 richard | |
| 307 # Forgot to pass the protected flag down *sigh*. | |
| 308 # | |
| 292 # Revision 1.11 2001/10/04 02:12:42 richard | 309 # Revision 1.11 2001/10/04 02:12:42 richard |
| 293 # Added nicer command-line item adding: passing no arguments will enter an | 310 # Added nicer command-line item adding: passing no arguments will enter an |
| 294 # interactive more which asks for each property in turn. While I was at it, I | 311 # interactive more which asks for each property in turn. While I was at it, I |
| 295 # fixed an implementation problem WRT the spec - I wasn't raising a | 312 # fixed an implementation problem WRT the spec - I wasn't raising a |
| 296 # ValueError if the key property was missing from a create(). Also added a | 313 # ValueError if the key property was missing from a create(). Also added a |
