comparison roundup/roundupdb.py @ 718:e10c37f53efd

fixed SCRIPT_NAME in ZRoundup for instances not at top level of Zope (thanks dman) fixed some sorting issues that were breaking some unit tests under py2.2 mailgw test output dir was confusing the init test (but only on 2.2 *shrug*) fixed bug in the init unit test that meant only the bsddb test ran if it could (it clobbered the anydbm test)
author Richard Jones <richard@users.sourceforge.net>
date Wed, 15 May 2002 03:27:16 +0000
parents de6dc74a4148
children 51c425129b35
comparison
equal deleted inserted replaced
717:14e94c28bdb0 718:e10c37f53efd
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.51 2002-04-08 03:46:42 richard Exp $ 18 # $Id: roundupdb.py,v 1.52 2002-05-15 03:27:16 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
420 quopri.encode(content, content_encoded, 0) 420 quopri.encode(content, content_encoded, 0)
421 content_encoded = content_encoded.getvalue() 421 content_encoded = content_encoded.getvalue()
422 422
423 # get the files for this message 423 # get the files for this message
424 message_files = messages.get(msgid, 'files') 424 message_files = messages.get(msgid, 'files')
425
426 # make sure the To line is always the same (for testing mostly)
427 sendto.sort()
425 428
426 # create the message 429 # create the message
427 message = cStringIO.StringIO() 430 message = cStringIO.StringIO()
428 writer = MimeWriter.MimeWriter(message) 431 writer = MimeWriter.MimeWriter(message)
429 writer.addheader('Subject', '[%s%s] %s'%(cn, nodeid, title)) 432 writer.addheader('Subject', '[%s%s] %s'%(cn, nodeid, title))
478 body.write(content_encoded) 481 body.write(content_encoded)
479 482
480 # now try to send the message 483 # now try to send the message
481 if SENDMAILDEBUG: 484 if SENDMAILDEBUG:
482 open(SENDMAILDEBUG, 'w').write('FROM: %s\nTO: %s\n%s\n'%( 485 open(SENDMAILDEBUG, 'w').write('FROM: %s\nTO: %s\n%s\n'%(
483 self.db.config.ADMIN_EMAIL,', '.join(sendto),message.getvalue())) 486 self.db.config.ADMIN_EMAIL,
487 ', '.join(sendto),message.getvalue()))
484 else: 488 else:
485 try: 489 try:
486 # send the message as admin so bounces are sent there 490 # send the message as admin so bounces are sent there
487 # instead of to roundup 491 # instead of to roundup
488 smtp = smtplib.SMTP(self.db.config.MAILHOST) 492 smtp = smtplib.SMTP(self.db.config.MAILHOST)
533 l = [] 537 l = []
534 link = self.db.classes[prop.classname] 538 link = self.db.classes[prop.classname]
535 key = link.labelprop(default_to_id=1) 539 key = link.labelprop(default_to_id=1)
536 if key: 540 if key:
537 value = [link.get(entry, key) for entry in value] 541 value = [link.get(entry, key) for entry in value]
542 value.sort()
538 value = ', '.join(value) 543 value = ', '.join(value)
539 m.append('%s: %s'%(propname, value)) 544 m.append('%s: %s'%(propname, value))
540 m.insert(0, '----------') 545 m.insert(0, '----------')
541 m.insert(0, '') 546 m.insert(0, '')
542 return '\n'.join(m) 547 return '\n'.join(m)
618 m.insert(0, '') 623 m.insert(0, '')
619 return '\n'.join(m) 624 return '\n'.join(m)
620 625
621 # 626 #
622 # $Log: not supported by cvs2svn $ 627 # $Log: not supported by cvs2svn $
628 # Revision 1.51 2002/04/08 03:46:42 richard
629 # make it work
630 #
623 # Revision 1.50 2002/04/08 03:40:31 richard 631 # Revision 1.50 2002/04/08 03:40:31 richard
624 # . added a "detectors" directory for people to put their useful auditors and 632 # . added a "detectors" directory for people to put their useful auditors and
625 # reactors in. Note - the roundupdb.IssueClass.sendmessage method has been 633 # reactors in. Note - the roundupdb.IssueClass.sendmessage method has been
626 # split and renamed "nosymessage" specifically for things like the nosy 634 # split and renamed "nosymessage" specifically for things like the nosy
627 # reactor, and "send_message" which just sends the message. 635 # reactor, and "send_message" which just sends the message.

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