Mercurial > p > roundup > code
comparison roundup/roundupdb.py @ 1096:fa7df238e2d4
More cleaning up of configuration, and the "instance" -> "tracker" renaming.
| author | Richard Jones <richard@users.sourceforge.net> |
|---|---|
| date | Tue, 10 Sep 2002 03:01:20 +0000 |
| parents | 711f2ecee20f |
| children | db787cef1385 |
comparison
equal
deleted
inserted
replaced
| 1095:711f2ecee20f | 1096:fa7df238e2d4 |
|---|---|
| 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.65 2002-09-10 02:37:28 richard Exp $ | 18 # $Id: roundupdb.py,v 1.66 2002-09-10 03:01:18 richard Exp $ |
| 19 | 19 |
| 20 __doc__ = """ | 20 __doc__ = """ |
| 21 Extending hyperdb with types specific to issue-tracking. | 21 Extending hyperdb with types specific to issue-tracking. |
| 22 """ | 22 """ |
| 23 | 23 |
| 212 message = cStringIO.StringIO() | 212 message = cStringIO.StringIO() |
| 213 writer = MimeWriter.MimeWriter(message) | 213 writer = MimeWriter.MimeWriter(message) |
| 214 writer.addheader('Subject', '[%s%s] %s'%(cn, nodeid, title)) | 214 writer.addheader('Subject', '[%s%s] %s'%(cn, nodeid, title)) |
| 215 writer.addheader('To', ', '.join(sendto)) | 215 writer.addheader('To', ', '.join(sendto)) |
| 216 writer.addheader('From', straddr( | 216 writer.addheader('From', straddr( |
| 217 (authname, self.db.config.ISSUE_TRACKER_EMAIL) ) ) | 217 (authname, self.db.config.TRACKER_EMAIL) ) ) |
| 218 writer.addheader('Reply-To', straddr( | 218 writer.addheader('Reply-To', straddr( |
| 219 (self.db.config.INSTANCE_NAME, | 219 (self.db.config.TRACKER_NAME, |
| 220 self.db.config.ISSUE_TRACKER_EMAIL) ) ) | 220 self.db.config.TRACKER_EMAIL) ) ) |
| 221 writer.addheader('MIME-Version', '1.0') | 221 writer.addheader('MIME-Version', '1.0') |
| 222 if messageid: | 222 if messageid: |
| 223 writer.addheader('Message-Id', messageid) | 223 writer.addheader('Message-Id', messageid) |
| 224 if inreplyto: | 224 if inreplyto: |
| 225 writer.addheader('In-Reply-To', inreplyto) | 225 writer.addheader('In-Reply-To', inreplyto) |
| 226 | 226 |
| 227 # add a uniquely Roundup header to help filtering | 227 # add a uniquely Roundup header to help filtering |
| 228 writer.addheader('X-Roundup-Name', self.db.config.INSTANCE_NAME) | 228 writer.addheader('X-Roundup-Name', self.db.config.TRACKER_NAME) |
| 229 | 229 |
| 230 # attach files | 230 # attach files |
| 231 if message_files: | 231 if message_files: |
| 232 part = writer.startmultipartbody('mixed') | 232 part = writer.startmultipartbody('mixed') |
| 233 part = writer.nextpart() | 233 part = writer.nextpart() |
| 286 ''' Add a signature to the e-mail with some useful information | 286 ''' Add a signature to the e-mail with some useful information |
| 287 ''' | 287 ''' |
| 288 | 288 |
| 289 # simplistic check to see if the url is valid, | 289 # simplistic check to see if the url is valid, |
| 290 # then append a trailing slash if it is missing | 290 # then append a trailing slash if it is missing |
| 291 base = self.db.config.ISSUE_TRACKER_WEB | 291 base = self.db.config.TRACKER_WEB |
| 292 if not isinstance(base , type('')) or not base.startswith('http://'): | 292 if not isinstance(base , type('')) or not base.startswith('http://'): |
| 293 base = "Configuration Error: ISSUE_TRACKER_WEB isn't a " \ | 293 base = "Configuration Error: TRACKER_WEB isn't a " \ |
| 294 "fully-qualified URL" | 294 "fully-qualified URL" |
| 295 elif base[-1] != '/' : | 295 elif base[-1] != '/' : |
| 296 base += '/' | 296 base += '/' |
| 297 web = base + 'issue'+ nodeid | 297 web = base + 'issue'+ nodeid |
| 298 | 298 |
| 299 # ensure the email address is properly quoted | 299 # ensure the email address is properly quoted |
| 300 email = straddr((self.db.config.INSTANCE_NAME, | 300 email = straddr((self.db.config.TRACKER_NAME, |
| 301 self.db.config.ISSUE_TRACKER_EMAIL)) | 301 self.db.config.TRACKER_EMAIL)) |
| 302 | 302 |
| 303 line = '_' * max(len(web), len(email)) | 303 line = '_' * max(len(web), len(email)) |
| 304 return '%s\n%s\n%s\n%s'%(line, email, web, line) | 304 return '%s\n%s\n%s\n%s'%(line, email, web, line) |
| 305 | 305 |
| 306 | 306 |
