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