Mercurial > p > roundup > code
diff 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 |
line wrap: on
line diff
--- a/roundup/mailgw.py Mon Nov 03 10:33:23 2003 +0000 +++ b/roundup/mailgw.py Mon Nov 03 18:34:03 2003 +0000 @@ -73,7 +73,7 @@ an exception, the original message is bounced back to the sender with the explanatory message given in the exception. -$Id: mailgw.py,v 1.135 2003-10-25 12:03:41 jlgijsbers Exp $ +$Id: mailgw.py,v 1.136 2003-11-03 18:34:03 jlgijsbers Exp $ """ import string, re, os, mimetools, cStringIO, smtplib, socket, binascii, quopri @@ -789,27 +789,27 @@ # # handle the attachments # - files = [] - for (name, mime_type, data) in attachments: - if not name: - name = "unnamed" - files.append(self.db.file.create(type=mime_type, name=name, - content=data, **file_props)) - # attach the files to the issue - if nodeid: - # extend the existing files list - fileprop = cl.get(nodeid, 'files') - fileprop.extend(files) - props['files'] = fileprop - else: - # pre-load the files list - props['files'] = files - + if properties.has_key('files'): + files = [] + for (name, mime_type, data) in attachments: + if not name: + name = "unnamed" + files.append(self.db.file.create(type=mime_type, name=name, + content=data, **file_props)) + # attach the files to the issue + if nodeid: + # extend the existing files list + fileprop = cl.get(nodeid, 'files') + fileprop.extend(files) + props['files'] = fileprop + else: + # pre-load the files list + props['files'] = files # # create the message if there's a message body (content) # - if content: + if (content and properties.has_key('messages')): message_id = self.db.msg.create(author=author, recipients=recipients, date=date.Date('.'), summary=summary, content=content, files=files, messageid=messageid,
