ec6e1761a5a32bda8335257f823627cfa41f9613
1 #
2 # Copyright (c) 2001 Bizar Software Pty Ltd (http://www.bizarsoftware.com.au/)
3 # This module is free software, and you may redistribute it and/or modify
4 # under the same terms as Python, so long as this copyright message and
5 # disclaimer are retained in their original form.
6 #
7 # IN NO EVENT SHALL BIZAR SOFTWARE PTY LTD BE LIABLE TO ANY PARTY FOR
8 # DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING
9 # OUT OF THE USE OF THIS CODE, EVEN IF THE AUTHOR HAS BEEN ADVISED OF THE
10 # POSSIBILITY OF SUCH DAMAGE.
11 #
12 # BIZAR SOFTWARE PTY LTD SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING,
13 # BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
14 # FOR A PARTICULAR PURPOSE. THE CODE PROVIDED HEREUNDER IS ON AN "AS IS"
15 # BASIS, AND THERE IS NO OBLIGATION WHATSOEVER TO PROVIDE MAINTENANCE,
16 # SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
17 #
19 __doc__ = '''
20 An e-mail gateway for Roundup.
22 Incoming messages are examined for multiple parts:
23 . In a multipart/mixed message or part, each subpart is extracted and
24 examined. The text/plain subparts are assembled to form the textual
25 body of the message, to be stored in the file associated with a "msg"
26 class node. Any parts of other types are each stored in separate files
27 and given "file" class nodes that are linked to the "msg" node.
28 . In a multipart/alternative message or part, we look for a text/plain
29 subpart and ignore the other parts.
31 Summary
32 -------
33 The "summary" property on message nodes is taken from the first non-quoting
34 section in the message body. The message body is divided into sections by
35 blank lines. Sections where the second and all subsequent lines begin with
36 a ">" or "|" character are considered "quoting sections". The first line of
37 the first non-quoting section becomes the summary of the message.
39 Addresses
40 ---------
41 All of the addresses in the To: and Cc: headers of the incoming message are
42 looked up among the user nodes, and the corresponding users are placed in
43 the "recipients" property on the new "msg" node. The address in the From:
44 header similarly determines the "author" property of the new "msg"
45 node. The default handling for addresses that don't have corresponding
46 users is to create new users with no passwords and a username equal to the
47 address. (The web interface does not permit logins for users with no
48 passwords.) If we prefer to reject mail from outside sources, we can simply
49 register an auditor on the "user" class that prevents the creation of user
50 nodes with no passwords.
52 Actions
53 -------
54 The subject line of the incoming message is examined to determine whether
55 the message is an attempt to create a new item or to discuss an existing
56 item. A designator enclosed in square brackets is sought as the first thing
57 on the subject line (after skipping any "Fwd:" or "Re:" prefixes).
59 If an item designator (class name and id number) is found there, the newly
60 created "msg" node is added to the "messages" property for that item, and
61 any new "file" nodes are added to the "files" property for the item.
63 If just an item class name is found there, we attempt to create a new item
64 of that class with its "messages" property initialized to contain the new
65 "msg" node and its "files" property initialized to contain any new "file"
66 nodes.
68 Triggers
69 --------
70 Both cases may trigger detectors (in the first case we are calling the
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
73 an exception, the original message is bounced back to the sender with the
74 explanatory message given in the exception.
76 $Id: mailgw.py,v 1.50 2002-01-11 22:59:01 richard Exp $
77 '''
80 import string, re, os, mimetools, cStringIO, smtplib, socket, binascii, quopri
81 import time, random
82 import traceback, MimeWriter
83 import hyperdb, date, password
85 SENDMAILDEBUG = os.environ.get('SENDMAILDEBUG', '')
87 class MailGWError(ValueError):
88 pass
90 class MailUsageError(ValueError):
91 pass
93 class UnAuthorized(Exception):
94 """ Access denied """
96 class Message(mimetools.Message):
97 ''' subclass mimetools.Message so we can retrieve the parts of the
98 message...
99 '''
100 def getPart(self):
101 ''' Get a single part of a multipart message and return it as a new
102 Message instance.
103 '''
104 boundary = self.getparam('boundary')
105 mid, end = '--'+boundary, '--'+boundary+'--'
106 s = cStringIO.StringIO()
107 while 1:
108 line = self.fp.readline()
109 if not line:
110 break
111 if line.strip() in (mid, end):
112 break
113 s.write(line)
114 if not s.getvalue().strip():
115 return None
116 s.seek(0)
117 return Message(s)
119 subject_re = re.compile(r'(?P<refwd>\s*\W?\s*(fwd|re)\s*\W?\s*)*'
120 r'\s*(\[(?P<classname>[^\d\s]+)(?P<nodeid>\d+)?\])'
121 r'\s*(?P<title>[^[]+)?(\[(?P<args>.+?)\])?', re.I)
123 class MailGW:
124 def __init__(self, instance, db):
125 self.instance = instance
126 self.db = db
128 def main(self, fp):
129 ''' fp - the file from which to read the Message.
130 '''
131 self.handle_Message(Message(fp))
133 def handle_Message(self, message):
134 '''Handle an RFC822 Message
136 Handle the Message object by calling handle_message() and then cope
137 with any errors raised by handle_message.
138 This method's job is to make that call and handle any
139 errors in a sane manner. It should be replaced if you wish to
140 handle errors in a different manner.
141 '''
142 # in some rare cases, a particularly stuffed-up e-mail will make
143 # its way into here... try to handle it gracefully
144 sendto = message.getaddrlist('from')
145 if sendto:
146 try:
147 return self.handle_message(message)
148 except MailUsageError, value:
149 # bounce the message back to the sender with the usage message
150 fulldoc = '\n'.join(string.split(__doc__, '\n')[2:])
151 sendto = [sendto[0][1]]
152 m = ['']
153 m.append(str(value))
154 m.append('\n\nMail Gateway Help\n=================')
155 m.append(fulldoc)
156 m = self.bounce_message(message, sendto, m)
157 except UnAuthorized, value:
158 # just inform the user that he is not authorized
159 sendto = [sendto[0][1]]
160 m = ['']
161 m.append(str(value))
162 m = self.bounce_message(message, sendto, m)
163 except:
164 # bounce the message back to the sender with the error message
165 sendto = [sendto[0][1]]
166 m = ['']
167 m.append('---- traceback of failure ----')
168 s = cStringIO.StringIO()
169 import traceback
170 traceback.print_exc(None, s)
171 m.append(s.getvalue())
172 m = self.bounce_message(message, sendto, m)
173 else:
174 # very bad-looking message - we don't even know who sent it
175 sendto = [self.ADMIN_EMAIL]
176 m = ['Subject: badly formed message from mail gateway']
177 m.append('')
178 m.append('The mail gateway retrieved a message which has no From:')
179 m.append('line, indicating that it is corrupt. Please check your')
180 m.append('mail gateway source. Failed message is attached.')
181 m.append('')
182 m = self.bounce_message(message, sendto, m,
183 subject='Badly formed message from mail gateway')
185 # now send the message
186 if SENDMAILDEBUG:
187 open(SENDMAILDEBUG, 'w').write('From: %s\nTo: %s\n%s\n'%(
188 self.ADMIN_EMAIL, ', '.join(sendto), m.getvalue()))
189 else:
190 try:
191 smtp = smtplib.SMTP(self.MAILHOST)
192 smtp.sendmail(self.ADMIN_EMAIL, sendto, m.getvalue())
193 except socket.error, value:
194 raise MailGWError, "Couldn't send error email: "\
195 "mailhost %s"%value
196 except smtplib.SMTPException, value:
197 raise MailGWError, "Couldn't send error email: %s"%value
199 def bounce_message(self, message, sendto, error,
200 subject='Failed issue tracker submission'):
201 ''' create a message that explains the reason for the failed
202 issue submission to the author and attach the original
203 message.
204 '''
205 msg = cStringIO.StringIO()
206 writer = MimeWriter.MimeWriter(msg)
207 writer.addheader('Subject', subject)
208 writer.addheader('From', '%s <%s>'% (self.instance.INSTANCE_NAME,
209 self.ISSUE_TRACKER_EMAIL))
210 writer.addheader('To', ','.join(sendto))
211 writer.addheader('MIME-Version', '1.0')
212 part = writer.startmultipartbody('mixed')
213 part = writer.nextpart()
214 body = part.startbody('text/plain')
215 body.write('\n'.join(error))
217 # reconstruct the original message
218 m = cStringIO.StringIO()
219 w = MimeWriter.MimeWriter(m)
220 # default the content_type, just in case...
221 content_type = 'text/plain'
222 # add the headers except the content-type
223 for header in message.headers:
224 header_name = header.split(':')[0]
225 if header_name.lower() == 'content-type':
226 content_type = message.getheader(header_name)
227 elif message.getheader(header_name):
228 w.addheader(header_name, message.getheader(header_name))
229 # now attach the message body
230 body = w.startbody(content_type)
231 try:
232 message.rewindbody()
233 except IOError:
234 body.write("*** couldn't include message body: read from pipe ***")
235 else:
236 body.write(message.fp.read())
238 # attach the original message to the returned message
239 part = writer.nextpart()
240 part.addheader('Content-Disposition','attachment')
241 part.addheader('Content-Description','Message that caused the error')
242 part.addheader('Content-Transfer-Encoding', '7bit')
243 body = part.startbody('message/rfc822')
244 body.write(m.getvalue())
246 writer.lastpart()
247 return msg
249 def handle_message(self, message):
250 ''' message - a Message instance
252 Parse the message as per the module docstring.
253 '''
254 # handle the subject line
255 subject = message.getheader('subject', '')
256 m = subject_re.match(subject)
257 if not m:
258 raise MailUsageError, '''
259 The message you sent to roundup did not contain a properly formed subject
260 line. The subject must contain a class name or designator to indicate the
261 "topic" of the message. For example:
262 Subject: [issue] This is a new issue
263 - this will create a new issue in the tracker with the title "This is
264 a new issue".
265 Subject: [issue1234] This is a followup to issue 1234
266 - this will append the message's contents to the existing issue 1234
267 in the tracker.
269 Subject was: "%s"
270 '''%subject
272 # get the classname
273 classname = m.group('classname')
274 try:
275 cl = self.db.getclass(classname)
276 except KeyError:
277 raise MailUsageError, '''
278 The class name you identified in the subject line ("%s") does not exist in the
279 database.
281 Valid class names are: %s
282 Subject was: "%s"
283 '''%(classname, ', '.join(self.db.getclasses()), subject)
285 # get the optional nodeid
286 nodeid = m.group('nodeid')
288 # title is optional too
289 title = m.group('title')
290 if title:
291 title = title.strip()
292 else:
293 title = ''
295 # but we do need either a title or a nodeid...
296 if not nodeid and not title:
297 raise MailUsageError, '''
298 I cannot match your message to a node in the database - you need to either
299 supply a full node identifier (with number, eg "[issue123]" or keep the
300 previous subject title intact so I can match that.
302 Subject was: "%s"
303 '''%subject
305 # extract the args
306 subject_args = m.group('args')
308 # If there's no nodeid, check to see if this is a followup and
309 # maybe someone's responded to the initial mail that created an
310 # entry. Try to find the matching nodes with the same title, and
311 # use the _last_ one matched (since that'll _usually_ be the most
312 # recent...)
313 if not nodeid and m.group('refwd'):
314 l = cl.stringFind(title=title)
315 if l:
316 nodeid = l[-1]
318 # start of the props
319 properties = cl.getprops()
320 props = {}
322 # handle the args
323 args = m.group('args')
324 if args:
325 for prop in string.split(args, ';'):
326 try:
327 key, value = prop.split('=')
328 except ValueError, message:
329 raise MailUsageError, '''
330 Subject argument list not of form [arg=value,value,...;arg=value,value...]
331 (specific exception message was "%s")
333 Subject was: "%s"
334 '''%(message, subject)
335 key = key.strip()
336 try:
337 proptype = properties[key]
338 except KeyError:
339 raise MailUsageError, '''
340 Subject argument list refers to an invalid property: "%s"
342 Subject was: "%s"
343 '''%(key, subject)
344 if isinstance(proptype, hyperdb.String):
345 props[key] = value.strip()
346 if isinstance(proptype, hyperdb.Password):
347 props[key] = password.Password(value.strip())
348 elif isinstance(proptype, hyperdb.Date):
349 try:
350 props[key] = date.Date(value.strip())
351 except ValueError, message:
352 raise UsageError, '''
353 Subject argument list contains an invalid date for %s.
355 Error was: %s
356 Subject was: "%s"
357 '''%(key, message, subject)
358 elif isinstance(proptype, hyperdb.Interval):
359 try:
360 props[key] = date.Interval(value) # no strip needed
361 except ValueError, message:
362 raise UsageError, '''
363 Subject argument list contains an invalid date interval for %s.
365 Error was: %s
366 Subject was: "%s"
367 '''%(key, message, subject)
368 elif isinstance(proptype, hyperdb.Link):
369 link = self.db.classes[proptype.classname]
370 propkey = link.labelprop(default_to_id=1)
371 try:
372 props[key] = link.get(value.strip(), propkey)
373 except:
374 props[key] = link.lookup(value.strip())
375 elif isinstance(proptype, hyperdb.Multilink):
376 link = self.db.classes[proptype.classname]
377 propkey = link.labelprop(default_to_id=1)
378 l = [x.strip() for x in value.split(',')]
379 for item in l:
380 try:
381 v = link.get(item, propkey)
382 except:
383 v = link.lookup(item)
384 if props.has_key(key):
385 props[key].append(v)
386 else:
387 props[key] = [v]
389 #
390 # handle the users
391 #
393 # Don't create users if ANONYMOUS_REGISTER is denied
394 if self.ANONYMOUS_REGISTER == 'deny':
395 create = 0
396 else:
397 create = 1
398 author = self.db.uidFromAddress(message.getaddrlist('from')[0],
399 create=create)
400 if not author:
401 raise UnAuthorized, '''
402 You are not a registered user.
404 Unknown address: %s
405 '''%message.getaddrlist('from')[0][1]
407 # the author may have been created - make sure the change is
408 # committed before we reopen the database
409 self.db.commit()
411 # reopen the database as the author
412 username = self.db.user.get(author, 'username')
413 self.db = self.instance.open(username)
415 # re-get the class with the new database connection
416 cl = self.db.getclass(classname)
418 # now update the recipients list
419 recipients = []
420 tracker_email = self.ISSUE_TRACKER_EMAIL.lower()
421 for recipient in message.getaddrlist('to') + message.getaddrlist('cc'):
422 r = recipient[1].strip().lower()
423 if r == tracker_email or not r:
424 continue
425 recipients.append(self.db.uidFromAddress(recipient))
427 #
428 # handle message-id and in-reply-to
429 #
430 messageid = message.getheader('message-id')
431 inreplyto = message.getheader('in-reply-to') or ''
432 # generate a messageid if there isn't one
433 if not messageid:
434 messageid = "<%s.%s.%s%s@%s>"%(time.time(), random.random(),
435 classname, nodeid, self.MAIL_DOMAIN)
437 #
438 # now handle the body - find the message
439 #
440 content_type = message.gettype()
441 attachments = []
442 if content_type == 'multipart/mixed':
443 # skip over the intro to the first boundary
444 part = message.getPart()
445 content = None
446 while 1:
447 # get the next part
448 part = message.getPart()
449 if part is None:
450 break
451 # parse it
452 subtype = part.gettype()
453 if subtype == 'text/plain' and not content:
454 # add all text/plain parts to the message content
455 if content is None:
456 content = part.fp.read()
457 else:
458 content = content + part.fp.read()
460 elif subtype == 'message/rfc822':
461 # handle message/rfc822 specially - the name should be
462 # the subject of the actual e-mail embedded here
463 i = part.fp.tell()
464 mailmess = Message(part.fp)
465 name = mailmess.getheader('subject')
466 part.fp.seek(i)
467 attachments.append((name, 'message/rfc822', part.fp.read()))
469 else:
470 # try name on Content-Type
471 name = part.getparam('name')
472 # this is just an attachment
473 encoding = part.getencoding()
474 if encoding == 'base64':
475 data = binascii.a2b_base64(part.fp.read())
476 elif encoding == 'quoted-printable':
477 # the quopri module wants to work with files
478 decoded = cStringIO.StringIO()
479 quopri.decode(part.fp, decoded)
480 data = decoded.getvalue()
481 elif encoding == 'uuencoded':
482 data = binascii.a2b_uu(part.fp.read())
483 attachments.append((name, part.gettype(), data))
485 if content is None:
486 raise MailUsageError, '''
487 Roundup requires the submission to be plain text. The message parser could
488 not find a text/plain part to use.
489 '''
491 elif content_type[:10] == 'multipart/':
492 # skip over the intro to the first boundary
493 message.getPart()
494 content = None
495 while 1:
496 # get the next part
497 part = message.getPart()
498 if part is None:
499 break
500 # parse it
501 if part.gettype() == 'text/plain' and not content:
502 # this one's our content
503 content = part.fp.read()
504 if content is None:
505 raise MailUsageError, '''
506 Roundup requires the submission to be plain text. The message parser could
507 not find a text/plain part to use.
508 '''
510 elif content_type != 'text/plain':
511 raise MailUsageError, '''
512 Roundup requires the submission to be plain text. The message parser could
513 not find a text/plain part to use.
514 '''
516 else:
517 content = message.fp.read()
519 summary, content = parseContent(content)
521 #
522 # handle the attachments
523 #
524 files = []
525 for (name, mime_type, data) in attachments:
526 files.append(self.db.file.create(type=mime_type, name=name,
527 content=data))
529 #
530 # now handle the db stuff
531 #
532 if nodeid:
533 # If an item designator (class name and id number) is found there,
534 # the newly created "msg" node is added to the "messages" property
535 # for that item, and any new "file" nodes are added to the "files"
536 # property for the item.
538 # if the message is currently 'unread' or 'resolved', then set
539 # it to 'chatting'
540 if properties.has_key('status'):
541 try:
542 # determine the id of 'unread', 'resolved' and 'chatting'
543 unread_id = self.db.status.lookup('unread')
544 resolved_id = self.db.status.lookup('resolved')
545 chatting_id = self.db.status.lookup('chatting')
546 except KeyError:
547 pass
548 else:
549 if (not props.has_key('status') and
550 properties['status'] == unread_id or
551 properties['status'] == resolved_id):
552 props['status'] = chatting_id
554 # add nosy in arguments to issue's nosy list
555 if not props.has_key('nosy'): props['nosy'] = []
556 n = {}
557 for nid in cl.get(nodeid, 'nosy'):
558 n[nid] = 1
559 for value in props['nosy']:
560 if self.db.hasnode('user', value):
561 nid = value
562 else:
563 continue
564 if n.has_key(nid): continue
565 n[nid] = 1
566 props['nosy'] = n.keys()
567 # add assignedto to the nosy list
568 try:
569 assignedto = self.db.user.lookup(props['assignedto'])
570 if assignedto not in props['nosy']:
571 props['nosy'].append(assignedto)
572 except:
573 pass
575 message_id = self.db.msg.create(author=author,
576 recipients=recipients, date=date.Date('.'), summary=summary,
577 content=content, files=files, messageid=messageid,
578 inreplyto=inreplyto)
579 try:
580 messages = cl.get(nodeid, 'messages')
581 except IndexError:
582 raise MailUsageError, '''
583 The node specified by the designator in the subject of your message ("%s")
584 does not exist.
586 Subject was: "%s"
587 '''%(nodeid, subject)
588 messages.append(message_id)
589 props['messages'] = messages
591 # now apply the changes
592 try:
593 cl.set(nodeid, **props)
594 except (TypeError, IndexError, ValueError), message:
595 raise MailUsageError, '''
596 There was a problem with the message you sent:
597 %s
598 '''%message
599 # commit the changes to the DB
600 self.db.commit()
601 else:
602 # If just an item class name is found there, we attempt to create a
603 # new item of that class with its "messages" property initialized to
604 # contain the new "msg" node and its "files" property initialized to
605 # contain any new "file" nodes.
606 message_id = self.db.msg.create(author=author,
607 recipients=recipients, date=date.Date('.'), summary=summary,
608 content=content, files=files, messageid=messageid,
609 inreplyto=inreplyto)
611 # pre-set the issue to unread
612 if properties.has_key('status') and not props.has_key('status'):
613 try:
614 # determine the id of 'unread'
615 unread_id = self.db.status.lookup('unread')
616 except KeyError:
617 pass
618 else:
619 props['status'] = '1'
621 # set the title to the subject
622 if properties.has_key('title') and not props.has_key('title'):
623 props['title'] = title
625 # pre-load the messages list
626 props['messages'] = [message_id]
628 # set up (clean) the nosy list
629 nosy = props.get('nosy', [])
630 n = {}
631 for value in nosy:
632 if self.db.hasnode('user', value):
633 nid = value
634 else:
635 continue
636 if n.has_key(nid): continue
637 n[nid] = 1
638 props['nosy'] = n.keys()
639 # add on the recipients of the message
640 for recipient in recipients:
641 if not n.has_key(recipient):
642 props['nosy'].append(recipient)
643 n[recipient] = 1
645 # add the author to the nosy list
646 if not n.has_key(author):
647 props['nosy'].append(author)
648 n[author] = 1
650 # add assignedto to the nosy list
651 if properties.has_key('assignedto') and props.has_key('assignedto'):
652 try:
653 assignedto = self.db.user.lookup(props['assignedto'])
654 except KeyError:
655 raise MailUsageError, '''
656 There was a problem with the message you sent:
657 Assignedto user '%s' doesn't exist
658 '''%props['assignedto']
659 if not n.has_key(assignedto):
660 props['nosy'].append(assignedto)
661 n[assignedto] = 1
663 # and attempt to create the new node
664 try:
665 nodeid = cl.create(**props)
666 except (TypeError, IndexError, ValueError), message:
667 raise MailUsageError, '''
668 There was a problem with the message you sent:
669 %s
670 '''%message
672 # commit the new node(s) to the DB
673 self.db.commit()
675 def parseContent(content, blank_line=re.compile(r'[\r\n]+\s*[\r\n]+'),
676 eol=re.compile(r'[\r\n]+'), signature=re.compile(r'^[>|\s]*[-_]+\s*$')):
677 ''' The message body is divided into sections by blank lines.
678 Sections where the second and all subsequent lines begin with a ">" or "|"
679 character are considered "quoting sections". The first line of the first
680 non-quoting section becomes the summary of the message.
681 '''
682 # strip off leading carriage-returns / newlines
683 i = 0
684 for i in range(len(content)):
685 if content[i] not in '\r\n':
686 break
687 if i > 0:
688 sections = blank_line.split(content[i:])
689 else:
690 sections = blank_line.split(content)
692 # extract out the summary from the message
693 summary = ''
694 l = []
695 for section in sections:
696 #section = section.strip()
697 if not section:
698 continue
699 lines = eol.split(section)
700 if (lines[0] and lines[0][0] in '>|') or (len(lines) > 1 and
701 lines[1] and lines[1][0] in '>|'):
702 # see if there's a response somewhere inside this section (ie.
703 # no blank line between quoted message and response)
704 for line in lines[1:]:
705 if line[0] not in '>|':
706 break
707 else:
708 # TODO: people who want to keep quoted bits will want the
709 # next line...
710 # l.append(section)
711 continue
712 # keep this section - it has reponse stuff in it
713 if not summary:
714 # and while we're at it, use the first non-quoted bit as
715 # our summary
716 summary = line
717 lines = lines[lines.index(line):]
718 section = '\n'.join(lines)
720 if not summary:
721 # if we don't have our summary yet use the first line of this
722 # section
723 summary = lines[0]
724 elif signature.match(lines[0]):
725 break
727 # and add the section to the output
728 l.append(section)
729 return summary, '\n\n'.join(l)
731 #
732 # $Log: not supported by cvs2svn $
733 # Revision 1.49 2002/01/10 06:19:18 richard
734 # followup lines directly after a quoted section were being eaten.
735 #
736 # Revision 1.48 2002/01/08 04:12:05 richard
737 # Changed message-id format to "<%s.%s.%s%s@%s>" so it complies with RFC822
738 #
739 # Revision 1.47 2002/01/02 02:32:38 richard
740 # ANONYMOUS_ACCESS -> ANONYMOUS_REGISTER
741 #
742 # Revision 1.46 2002/01/02 02:31:38 richard
743 # Sorry for the huge checkin message - I was only intending to implement #496356
744 # but I found a number of places where things had been broken by transactions:
745 # . modified ROUNDUPDBSENDMAILDEBUG to be SENDMAILDEBUG and hold a filename
746 # for _all_ roundup-generated smtp messages to be sent to.
747 # . the transaction cache had broken the roundupdb.Class set() reactors
748 # . newly-created author users in the mailgw weren't being committed to the db
749 #
750 # Stuff that made it into CHANGES.txt (ie. the stuff I was actually working
751 # on when I found that stuff :):
752 # . #496356 ] Use threading in messages
753 # . detectors were being registered multiple times
754 # . added tests for mailgw
755 # . much better attaching of erroneous messages in the mail gateway
756 #
757 # Revision 1.45 2001/12/20 15:43:01 rochecompaan
758 # Features added:
759 # . Multilink properties are now displayed as comma separated values in
760 # a textbox
761 # . The add user link is now only visible to the admin user
762 # . Modified the mail gateway to reject submissions from unknown
763 # addresses if ANONYMOUS_ACCESS is denied
764 #
765 # Revision 1.44 2001/12/18 15:30:34 rochecompaan
766 # Fixed bugs:
767 # . Fixed file creation and retrieval in same transaction in anydbm
768 # backend
769 # . Cgi interface now renders new issue after issue creation
770 # . Could not set issue status to resolved through cgi interface
771 # . Mail gateway was changing status back to 'chatting' if status was
772 # omitted as an argument
773 #
774 # Revision 1.43 2001/12/15 19:39:01 rochecompaan
775 # Oops.
776 #
777 # Revision 1.42 2001/12/15 19:24:39 rochecompaan
778 # . Modified cgi interface to change properties only once all changes are
779 # collected, files created and messages generated.
780 # . Moved generation of change note to nosyreactors.
781 # . We now check for changes to "assignedto" to ensure it's added to the
782 # nosy list.
783 #
784 # Revision 1.41 2001/12/10 00:57:38 richard
785 # From CHANGES:
786 # . Added the "display" command to the admin tool - displays a node's values
787 # . #489760 ] [issue] only subject
788 # . fixed the doc/index.html to include the quoting in the mail alias.
789 #
790 # Also:
791 # . fixed roundup-admin so it works with transactions
792 # . disabled the back_anydbm module if anydbm tries to use dumbdbm
793 #
794 # Revision 1.40 2001/12/05 14:26:44 rochecompaan
795 # Removed generation of change note from "sendmessage" in roundupdb.py.
796 # The change note is now generated when the message is created.
797 #
798 # Revision 1.39 2001/12/02 05:06:16 richard
799 # . We now use weakrefs in the Classes to keep the database reference, so
800 # the close() method on the database is no longer needed.
801 # I bumped the minimum python requirement up to 2.1 accordingly.
802 # . #487480 ] roundup-server
803 # . #487476 ] INSTALL.txt
804 #
805 # I also cleaned up the change message / post-edit stuff in the cgi client.
806 # There's now a clearly marked "TODO: append the change note" where I believe
807 # the change note should be added there. The "changes" list will obviously
808 # have to be modified to be a dict of the changes, or somesuch.
809 #
810 # More testing needed.
811 #
812 # Revision 1.38 2001/12/01 07:17:50 richard
813 # . We now have basic transaction support! Information is only written to
814 # the database when the commit() method is called. Only the anydbm
815 # backend is modified in this way - neither of the bsddb backends have been.
816 # The mail, admin and cgi interfaces all use commit (except the admin tool
817 # doesn't have a commit command, so interactive users can't commit...)
818 # . Fixed login/registration forwarding the user to the right page (or not,
819 # on a failure)
820 #
821 # Revision 1.37 2001/11/28 21:55:35 richard
822 # . login_action and newuser_action return values were being ignored
823 # . Woohoo! Found that bloody re-login bug that was killing the mail
824 # gateway.
825 # (also a minor cleanup in hyperdb)
826 #
827 # Revision 1.36 2001/11/26 22:55:56 richard
828 # Feature:
829 # . Added INSTANCE_NAME to configuration - used in web and email to identify
830 # the instance.
831 # . Added EMAIL_SIGNATURE_POSITION to indicate where to place the roundup
832 # signature info in e-mails.
833 # . Some more flexibility in the mail gateway and more error handling.
834 # . Login now takes you to the page you back to the were denied access to.
835 #
836 # Fixed:
837 # . Lots of bugs, thanks Roché and others on the devel mailing list!
838 #
839 # Revision 1.35 2001/11/22 15:46:42 jhermann
840 # Added module docstrings to all modules.
841 #
842 # Revision 1.34 2001/11/15 10:24:27 richard
843 # handle the case where there is no file attached
844 #
845 # Revision 1.33 2001/11/13 21:44:44 richard
846 # . re-open the database as the author in mail handling
847 #
848 # Revision 1.32 2001/11/12 22:04:29 richard
849 # oops, left debug in there
850 #
851 # Revision 1.31 2001/11/12 22:01:06 richard
852 # Fixed issues with nosy reaction and author copies.
853 #
854 # Revision 1.30 2001/11/09 22:33:28 richard
855 # More error handling fixes.
856 #
857 # Revision 1.29 2001/11/07 05:29:26 richard
858 # Modified roundup-mailgw so it can read e-mails from a local mail spool
859 # file. Truncates the spool file after parsing.
860 # Fixed a couple of small bugs introduced in roundup.mailgw when I started
861 # the popgw.
862 #
863 # Revision 1.28 2001/11/01 22:04:37 richard
864 # Started work on supporting a pop3-fetching server
865 # Fixed bugs:
866 # . bug #477104 ] HTML tag error in roundup-server
867 # . bug #477107 ] HTTP header problem
868 #
869 # Revision 1.27 2001/10/30 11:26:10 richard
870 # Case-insensitive match for ISSUE_TRACKER_EMAIL in address in e-mail.
871 #
872 # Revision 1.26 2001/10/30 00:54:45 richard
873 # Features:
874 # . #467129 ] Lossage when username=e-mail-address
875 # . #473123 ] Change message generation for author
876 # . MailGW now moves 'resolved' to 'chatting' on receiving e-mail for an issue.
877 #
878 # Revision 1.25 2001/10/28 23:22:28 richard
879 # fixed bug #474749 ] Indentations lost
880 #
881 # Revision 1.24 2001/10/23 22:57:52 richard
882 # Fix unread->chatting auto transition, thanks Roch'e
883 #
884 # Revision 1.23 2001/10/21 04:00:20 richard
885 # MailGW now moves 'unread' to 'chatting' on receiving e-mail for an issue.
886 #
887 # Revision 1.22 2001/10/21 03:35:13 richard
888 # bug #473125: Paragraph in e-mails
889 #
890 # Revision 1.21 2001/10/21 00:53:42 richard
891 # bug #473130: Nosy list not set correctly
892 #
893 # Revision 1.20 2001/10/17 23:13:19 richard
894 # Did a fair bit of work on the admin tool. Now has an extra command "table"
895 # which displays node information in a tabular format. Also fixed import and
896 # export so they work. Removed freshen.
897 # Fixed quopri usage in mailgw from bug reports.
898 #
899 # Revision 1.19 2001/10/11 23:43:04 richard
900 # Implemented the comma-separated printing option in the admin tool.
901 # Fixed a typo (more of a vim-o actually :) in mailgw.
902 #
903 # Revision 1.18 2001/10/11 06:38:57 richard
904 # Initial cut at trying to handle people responding to CC'ed messages that
905 # create an issue.
906 #
907 # Revision 1.17 2001/10/09 07:25:59 richard
908 # Added the Password property type. See "pydoc roundup.password" for
909 # implementation details. Have updated some of the documentation too.
910 #
911 # Revision 1.16 2001/10/05 02:23:24 richard
912 # . roundup-admin create now prompts for property info if none is supplied
913 # on the command-line.
914 # . hyperdb Class getprops() method may now return only the mutable
915 # properties.
916 # . Login now uses cookies, which makes it a whole lot more flexible. We can
917 # now support anonymous user access (read-only, unless there's an
918 # "anonymous" user, in which case write access is permitted). Login
919 # handling has been moved into cgi_client.Client.main()
920 # . The "extended" schema is now the default in roundup init.
921 # . The schemas have had their page headings modified to cope with the new
922 # login handling. Existing installations should copy the interfaces.py
923 # file from the roundup lib directory to their instance home.
924 # . Incorrectly had a Bizar Software copyright on the cgitb.py module from
925 # Ping - has been removed.
926 # . Fixed a whole bunch of places in the CGI interface where we should have
927 # been returning Not Found instead of throwing an exception.
928 # . Fixed a deviation from the spec: trying to modify the 'id' property of
929 # an item now throws an exception.
930 #
931 # Revision 1.15 2001/08/30 06:01:17 richard
932 # Fixed missing import in mailgw :(
933 #
934 # Revision 1.14 2001/08/13 23:02:54 richard
935 # Make the mail parser a little more robust.
936 #
937 # Revision 1.13 2001/08/12 06:32:36 richard
938 # using isinstance(blah, Foo) now instead of isFooType
939 #
940 # Revision 1.12 2001/08/08 01:27:00 richard
941 # Added better error handling to mailgw.
942 #
943 # Revision 1.11 2001/08/08 00:08:03 richard
944 # oops ;)
945 #
946 # Revision 1.10 2001/08/07 00:24:42 richard
947 # stupid typo
948 #
949 # Revision 1.9 2001/08/07 00:15:51 richard
950 # Added the copyright/license notice to (nearly) all files at request of
951 # Bizar Software.
952 #
953 # Revision 1.8 2001/08/05 07:06:07 richard
954 # removed some print statements
955 #
956 # Revision 1.7 2001/08/03 07:18:22 richard
957 # Implemented correct mail splitting (was taking a shortcut). Added unit
958 # tests. Also snips signatures now too.
959 #
960 # Revision 1.6 2001/08/01 04:24:21 richard
961 # mailgw was assuming certain properties existed on the issues being created.
962 #
963 # Revision 1.5 2001/07/29 07:01:39 richard
964 # Added vim command to all source so that we don't get no steenkin' tabs :)
965 #
966 # Revision 1.4 2001/07/28 06:43:02 richard
967 # Multipart message class has the getPart method now. Added some tests for it.
968 #
969 # Revision 1.3 2001/07/28 00:34:34 richard
970 # Fixed some non-string node ids.
971 #
972 # Revision 1.2 2001/07/22 12:09:32 richard
973 # Final commit of Grande Splite
974 #
975 #
976 # vim: set filetype=python ts=4 sw=4 et si