diff --git a/roundup/roundupdb.py b/roundup/roundupdb.py
index 45fb8e8b583c94829aa4cb30f60279194fff76bc..19b3004b102d99a117c34da4ea07f78c1c398790 100644 (file)
--- a/roundup/roundupdb.py
+++ b/roundup/roundupdb.py
from email.MIMEText import MIMEText
from email.MIMEBase import MIMEBase
+from anypy.email_ import FeedParser
+
from roundup import password, date, hyperdb
from roundup.i18n import _
elif isinstance(proptype, hyperdb.Interval):
props[propname] = date.Interval(value)
elif isinstance(proptype, hyperdb.Password):
- props[propname] = password.Password()
- props[propname].unpack(value)
+ props[propname] = password.Password(encrypted=value)
# tag new user creation with 'admin'
self.journaltag = 'admin'
# Because getting a logger requires acquiring a lock, we want
# to do it only once.
if not hasattr(self, '__logger'):
- self.__logger = logging.getLogger('hyperdb')
+ self.__logger = logging.getLogger('roundup.hyperdb')
return self.__logger
"""
def nosymessage(self, issueid, msgid, oldvalues, whichnosy='nosy',
- from_address=None, cc=[], bcc=[]):
+ from_address=None, cc=[], bcc=[], cc_emails = [], bcc_emails = []):
"""Send a message to the members of an issue's nosy list.
The message is sent only to users on the nosy list who are not
message to that may not be specified in the message's recipients
list. These recipients will not be included in the To: or Cc:
address lists.
+
+ The cc_emails and bcc_emails arguments take a list of additional
+ recipient email addresses (just the mail address not roundup users)
+ this can be useful for sending to additional email addresses which are no
+ roundup users. These arguments are currently not used by roundups
+ nosyreaction but can be used by customized (nosy-)reactors.
"""
if msgid:
authid = self.db.msg.get(msgid, 'author')
user or a user who has already seen the message.
Also check permissions on the message if not a system
message: A user must have view permission on content and
- files to be on the receiver list. We do *not* check the
+ files to be on the receiver list. We do *not* check the
author etc. for now.
"""
allowed = True
for userid in cc + self.get(issueid, whichnosy):
if good_recipient(userid):
add_recipient(userid, sendto)
+ sendto.extend (cc_emails)
# now deal with bcc people.
for userid in bcc:
if good_recipient(userid):
add_recipient(userid, bcc_sendto)
+ bcc_sendto.extend (bcc_emails)
if oldvalues:
note = self.generateChangeNote(issueid, oldvalues)
if message_files:
# first up the text as a part
part = MIMEText(body)
+ part.set_charset(charset)
encode_quopri(part)
message.attach(part)
else:
part = MIMEText(content)
part['Content-Transfer-Encoding'] = '7bit'
+ elif mime_type == 'message/rfc822':
+ main, sub = mime_type.split('/')
+ p = FeedParser()
+ p.feed(content)
+ part = MIMEBase(main, sub)
+ part.set_payload([p.close()])
else:
# some other type, so encode it
if not mime_type:
part = MIMEBase(main, sub)
part.set_payload(content)
Encoders.encode_base64(part)
- part['Content-Disposition'] = 'attachment;\n filename="%s"'%name
+ cd = 'Content-Disposition'
+ part[cd] = 'attachment;\n filename="%s"'%name
message.attach(part)
else: