2005/03/28

CommitMessage and HTML emails

I'm playing with Subversion these days, and a co-worker pointed me at this occasion to the CommitMessage framework. Small and neat architecture. The default text message is quite complete but can get a little bit obscure for large commits, so I hacked a HTML message extension. Here is the result:
User: olg
Date: 2005/03/28 03:56 PM
Log:
Support for subject/content filters
Modified:
/metameta/English.lproj/TextFilterInspector.nib/
info.nib, keyedobjects.nib
File Changes:
Directory: /metameta/English.lproj/TextFilterInspector.nib/
File [modified]: info.nib
Delta lines: +1 -1
===================================================================
--- mm/English.lproj/Test.nib/info.nib 2004-05-28 20:49:23 UTC (rev 81)
+++ mm/English.lproj//Test.nib/info.nib 2004-05-28 20:49:37 UTC (rev 82)
@@ -11,6 +11,6 @@
   14
  
  IBSystem Version
- 7F44
+ 7H63
 
 
File [modified]: keyedobjects.nib
Delta lines: +0 -0
===================================================================
(Binary files differ)
Instructions
You should now receive HTML-formatted emails on your commit (there is also a plain text alternative, Tigris-style, in the message).
Other notes
The HTML message is styled with embedded CSS. The CSS rules are currently hard-coded in the Python file, it should probably stored in a separate CSS file and embedded on message construction or with an option to override.

Some problems with Python when writing this extension. I'm an absolute beginner in Python, so I'm probably missing something. My first implementation used mimetools and MimeWrite, but I learned that the email module was probably better, I rewrote it. The issue was that I included my HTMLStyleEmailView inside the commitmessage-provided email.py (thus commitmessage.views.email module), and doing an import email from within this module was ambiguous. I moved everything to a separate commitmessage.views.extensions module and everything was fine. Please let me know if there is a clean way to reference a top-level module from a module with a similar name.

I was not able to just inherit from BaseEmailView as the execute method finishes the mail headers before calling generateBody, and I needed header customization to define the MIME multipart info.


Comments: Post a Comment

<< Home

This page is powered by Blogger. Isn't yours?