Ticket #62 (closed task: fixed)
Proposed Message class rewrite for v.3.0.
| Reported by: | amcgregor | Owned by: | amcgregor |
|---|---|---|---|
| Priority: | normal | Milestone: | 3.0 |
| Component: | message-class | Version: | |
| Keywords: | Cc: |
Description
I have completely re-factored the Message class as of changeset:35. See source:/branches/3.0/turbomail/message.py@35.
Using this new class, things basically remain as they were, though the code is much cleaner. Integrity is easier to maintain on properties which should be lists (to, sender, cc, bcc, etc.) and MIME generation is handled much more efficiently. A few properties have been renamed to be more descriptive or more obvious.
The following is a simple test case using ipython in the package folder:
In [1]: import turbomail
In [4]: message = turbomail.Message(
...: sender=("Matthew Bevan", "matt.bevan@topfloor.ca"),
...: to=("Alice McGregor", "alice@gothcandy.com"),
...: subject="Test message.",
...: plain="This is a test message.")
In [3]: print message
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Sender: "Matthew Bevan" <matt.bevan@topfloor.ca>
From: "Matthew Bevan" <matt.bevan@topfloor.ca>
Subject: Test message.
Date: Tue, 16 Oct 2007 23:53:27 -0700
To: "Alice McGregor" <alice@gothcandy.com>
X-Mailer: TurboMail <http://www.python-turbomail.org/>
X-TurboMail-Version: 3.0
X-TurboMail-Extensions:
This is a test message.
I'll be writing (and hopefully maintaining) actual useful unit tests as I re-work TurboMail for milestone:3.0.
Comments, discussion, and patches are welcome.
