Mercurial > p > roundup > code
comparison roundup/mailgw.py @ 1887:9d8d5fa0d9ad
Don't rely on being about an issue...
...when submitting a message to the mail gateway.
| author | Johannes Gijsbers <jlgijsbers@users.sourceforge.net> |
|---|---|
| date | Mon, 03 Nov 2003 18:34:03 +0000 |
| parents | ea63531ddeec |
| children | dc43e339e607 |
comparison
equal
deleted
inserted
replaced
| 1886:e3cff1bb1b86 | 1887:9d8d5fa0d9ad |
|---|---|
| 71 set() method to add the message to the item's spool; in the second case we | 71 set() method to add the message to the item's spool; in the second case we |
| 72 are calling the create() method to create a new node). If an auditor raises | 72 are calling the create() method to create a new node). If an auditor raises |
| 73 an exception, the original message is bounced back to the sender with the | 73 an exception, the original message is bounced back to the sender with the |
| 74 explanatory message given in the exception. | 74 explanatory message given in the exception. |
| 75 | 75 |
| 76 $Id: mailgw.py,v 1.135 2003-10-25 12:03:41 jlgijsbers Exp $ | 76 $Id: mailgw.py,v 1.136 2003-11-03 18:34:03 jlgijsbers Exp $ |
| 77 """ | 77 """ |
| 78 | 78 |
| 79 import string, re, os, mimetools, cStringIO, smtplib, socket, binascii, quopri | 79 import string, re, os, mimetools, cStringIO, smtplib, socket, binascii, quopri |
| 80 import time, random, sys | 80 import time, random, sys |
| 81 import traceback, MimeWriter, rfc822 | 81 import traceback, MimeWriter, rfc822 |
| 787 content = content.strip() | 787 content = content.strip() |
| 788 | 788 |
| 789 # | 789 # |
| 790 # handle the attachments | 790 # handle the attachments |
| 791 # | 791 # |
| 792 files = [] | 792 if properties.has_key('files'): |
| 793 for (name, mime_type, data) in attachments: | 793 files = [] |
| 794 if not name: | 794 for (name, mime_type, data) in attachments: |
| 795 name = "unnamed" | 795 if not name: |
| 796 files.append(self.db.file.create(type=mime_type, name=name, | 796 name = "unnamed" |
| 797 content=data, **file_props)) | 797 files.append(self.db.file.create(type=mime_type, name=name, |
| 798 # attach the files to the issue | 798 content=data, **file_props)) |
| 799 if nodeid: | 799 # attach the files to the issue |
| 800 # extend the existing files list | 800 if nodeid: |
| 801 fileprop = cl.get(nodeid, 'files') | 801 # extend the existing files list |
| 802 fileprop.extend(files) | 802 fileprop = cl.get(nodeid, 'files') |
| 803 props['files'] = fileprop | 803 fileprop.extend(files) |
| 804 else: | 804 props['files'] = fileprop |
| 805 # pre-load the files list | 805 else: |
| 806 props['files'] = files | 806 # pre-load the files list |
| 807 | 807 props['files'] = files |
| 808 | 808 |
| 809 # | 809 # |
| 810 # create the message if there's a message body (content) | 810 # create the message if there's a message body (content) |
| 811 # | 811 # |
| 812 if content: | 812 if (content and properties.has_key('messages')): |
| 813 message_id = self.db.msg.create(author=author, | 813 message_id = self.db.msg.create(author=author, |
| 814 recipients=recipients, date=date.Date('.'), summary=summary, | 814 recipients=recipients, date=date.Date('.'), summary=summary, |
| 815 content=content, files=files, messageid=messageid, | 815 content=content, files=files, messageid=messageid, |
| 816 inreplyto=inreplyto, **msg_props) | 816 inreplyto=inreplyto, **msg_props) |
| 817 | 817 |
