diff --git a/roundup/roundupdb.py b/roundup/roundupdb.py
index 1baf624872ea59fae91186409ab58556b81b20e1..af624eba974697dfd9fd599eee7b98a0cc0ffb8e 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.66 2002-09-10 03:01:18 richard Exp $
+# $Id: roundupdb.py,v 1.74 2002-12-10 00:23:36 richard Exp $
__doc__ = """
Extending hyperdb with types specific to issue-tracking.
import base64, quopri, mimetypes
# if available, use the 'email' module, otherwise fallback to 'rfc822'
try :
- from email.Utils import dump_address_pair as straddr
+ from email.Utils import formataddr as straddr
except ImportError :
- from rfc822 import dump_address_pair as straddr
+ # code taken from the email package 2.4.3
+ def straddr(pair, specialsre = re.compile(r'[][\()<>@,:;".]'),
+ escapesre = re.compile(r'[][\()"]')):
+ name, address = pair
+ if name:
+ quotes = ''
+ if specialsre.search(name):
+ quotes = '"'
+ name = escapesre.sub(r'\\\g<0>', name)
+ return '%s%s%s <%s>' % (quotes, name, quotes, address)
+ return address
import hyperdb
pass
class DetectorError(RuntimeError):
+ ''' Raised by detectors that want to indicate that something's amiss
+ '''
pass
-# XXX deviation from spec - was called ItemClass
+# deviation from spec - was called IssueClass
class IssueClass:
""" This class is intended to be mixed-in with a hyperdb backend
implementation. The backend should provide a mechanism that
# send the message
self.send_message(nodeid, msgid, note, sendto)
- # XXX backwards compatibility - don't remove
+ # backwards compatibility - don't remove
sendmessage = nosymessage
def send_message(self, nodeid, msgid, note, sendto):
# add a uniquely Roundup header to help filtering
writer.addheader('X-Roundup-Name', self.db.config.TRACKER_NAME)
+ # avoid email loops
+ writer.addheader('X-Roundup-Loop', 'hello')
+
# attach files
if message_files:
part = writer.startmultipartbody('mixed')
def email_signature(self, nodeid, msgid):
''' Add a signature to the e-mail with some useful information
'''
-
# simplistic check to see if the url is valid,
# then append a trailing slash if it is missing
base = self.db.config.TRACKER_WEB
- if not isinstance(base , type('')) or not base.startswith('http://'):
+ if (not isinstance(base , type('')) or
+ not (base.startswith('http://') or base.startswith('https://'))):
base = "Configuration Error: TRACKER_WEB isn't a " \
"fully-qualified URL"
elif base[-1] != '/' :
base += '/'
- web = base + 'issue'+ nodeid
+ web = base + self.classname + nodeid
# ensure the email address is properly quoted
email = straddr((self.db.config.TRACKER_NAME,
# determine what changed
for key in oldvalues.keys():
- if key in ['files','messages']: continue
+ if key in ['files','messages']:
+ continue
+ if key in ('activity', 'creator', 'creation'):
+ continue
new_value = cl.get(nodeid, key)
# the old value might be non existent
try: