diff --git a/roundup/roundupdb.py b/roundup/roundupdb.py
index 761f1ae4f8a5da4e93a1316737bd63e149373e5f..d59d41e64e8970f2d37d0c42a49331b0e00fa615 100644 (file)
--- a/roundup/roundupdb.py
+++ b/roundup/roundupdb.py
# BASIS, AND THERE IS NO OBLIGATION WHATSOEVER TO PROVIDE MAINTENANCE,
# SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
#
-# $Id: roundupdb.py,v 1.97 2004-02-11 23:55:08 richard Exp $
+# $Id: roundupdb.py,v 1.106 2004-04-05 06:13:42 richard Exp $
"""Extending hyperdb with types specific to issue-tracking.
"""
# If there is no class 'user' or current user doesn't have timezone
# property or that property is not numeric assume he/she lives in
# Greenwich :)
- timezone = 0
+ timezone = getattr(self.config, 'DEFAULT_TIMEZONE', 0)
return timezone
def confirm_registration(self, otk):
- props = self.otks.getall(otk)
+ props = self.getOTKManager().getall(otk)
for propname, proptype in self.user.getprops().items():
value = props.get(propname, None)
if value is None:
cl = self.user
props['roles'] = self.config.NEW_WEB_USER_ROLES
- del props['__time']
userid = cl.create(**props)
# clear the props from the otk database
- self.otks.destroy(otk)
+ self.getOTKManager().destroy(otk)
self.commit()
return userid
if address:
sendto.append(address)
recipients.append(userid)
-
+
def good_recipient(userid):
# Make sure we don't send mail to either the anonymous
# user or a user who has already seen the message.
return (userid and
(self.db.user.get(userid, 'username') != 'anonymous') and
not seen_message.has_key(userid))
-
+
# possibly send the message to the author, as long as they aren't
# anonymous
if (good_recipient(authid) and
self.db.config.MAIL_DOMAIN)
messages.set(msgid, messageid=messageid)
- # send an email to the people who missed out
+ # compose title
cn = self.classname
title = self.get(nodeid, 'title') or '%s message copy'%cn
+ # figure author information
authid = messages.safeget(msgid, 'author')
authname = users.safeget(authid, 'realname')
if not authname:
m.append(self.email_signature(nodeid, msgid))
# encode the content as quoted-printable
- content = cStringIO.StringIO('\n'.join(m))
+ charset = getattr(self.db.config, 'EMAIL_CHARSET', 'utf-8')
+ m = '\n'.join(m)
+ if charset != 'utf-8':
+ m = unicode(m, 'utf-8').encode(charset)
+ content = cStringIO.StringIO(m)
content_encoded = cStringIO.StringIO()
quopri.encode(content, content_encoded, 0)
content_encoded = content_encoded.getvalue()
if from_tag:
from_tag = ' ' + from_tag
- subject = '[%s%s] %s' % (cn, nodeid, encode_header(title))
- author = straddr((encode_header(authname) + from_tag, from_address))
+ subject = '[%s%s] %s'%(cn, nodeid, title)
+ author = (authname + from_tag, from_address)
# create the message
mailer = Mailer(self.db.config)
message, writer = mailer.get_standard_message(sendto, subject, author)
- tracker_name = encode_header(self.db.config.TRACKER_NAME)
+ # set reply-to to the tracker
+ tracker_name = self.db.config.TRACKER_NAME
+ if charset != 'utf-8':
+ tracker = unicode(tracker_name, 'utf-8').encode(charset)
+ tracker_name = encode_header(tracker_name, charset)
writer.addheader('Reply-To', straddr((tracker_name, from_address)))
+
+ # message ids
if messageid:
writer.addheader('Message-Id', messageid)
if inreplyto:
part = writer.startmultipartbody('mixed')
part = writer.nextpart()
part.addheader('Content-Transfer-Encoding', 'quoted-printable')
- body = part.startbody('text/plain; charset=utf-8')
+ body = part.startbody('text/plain; charset=%s'%charset)
body.write(content_encoded)
for fileid in message_files:
name = files.get(fileid, 'name')
writer.lastpart()
else:
writer.addheader('Content-Transfer-Encoding', 'quoted-printable')
- body = writer.startbody('text/plain; charset=utf-8')
+ body = writer.startbody('text/plain; charset=%s'%charset)
body.write(content_encoded)
mailer.smtp_send(sendto, message)
base = self.db.config.TRACKER_WEB
if (not isinstance(base , type('')) or
not (base.startswith('http://') or base.startswith('https://'))):
- base = "Configuration Error: TRACKER_WEB isn't a " \
+ web = "Configuration Error: TRACKER_WEB isn't a " \
"fully-qualified URL"
- elif base[-1] != '/' :
- base += '/'
- web = base + self.classname + nodeid
+ else:
+ if not base.endswith('/'):
+ base = base + '/'
+ web = base + self.classname + nodeid
# ensure the email address is properly quoted
email = straddr((self.db.config.TRACKER_NAME,
self.db.config.TRACKER_EMAIL))
line = '_' * max(len(web)+2, len(email))
- return '%s\n%s\n<%s>\n%s'%(line, email, web, line)
+ return '\n%s\n%s\n<%s>\n%s'%(line, email, web, line)
def generateCreateNote(self, nodeid):
for key in oldvalues.keys():
if key in ['files','messages']:
continue
- if key in ('activity', 'creator', 'creation'):
+ if key in ('actor', 'activity', 'creator', 'creation'):
continue
# not all keys from oldvalues might be available in database
# this happens when property was deleted