Ed:
Thanks for that. Your code was a huge hit at the last PySIG meeting.
Naturally, no one could get by without commenting. A great suggestion was to change the template code from %s to %(Name)s or %(Subject)s and change the fill to a dictionary fill = {"Date"=>"06/12/06, "To"=>ed (AT) example .D.O.T com} and then you can move around fields in the template without having to re-arrange the order of fields in the fill list. Neat trick! One of these days I'll learn a bit of Python...
On Jun 6, 2006, at 4:04 PM, Ed Leafe wrote:
> On Jun 6, 2006, at 3:29 PM, Ted Roche wrote: > >> Would you be willing to share the commit-svn.py script as well? >> This is a handy way to keep up on changes. > > What! Share code! What are you, some kinda commie?? ;-) > > - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - > #!/usr/bin/env python > > import os > import sys > import time > import smtplib > > tmplt = """From: subversion@leafe.com > To: %s > Subject: %s > Date: %s > > Author- %s > Revision #%s > %s > > Log Message: > %s > > > Diff: > %s > """ > > if __name__ == "__main__": > try: > args = sys.argv > adds = args[1].split(",") > for addr in adds: > fill = (addr, args[2], time.ctime(), args[3], args[4], > time.ctime(), args[5], args[6]) > msg = tmplt % fill > oSMTP = smtplib.SMTP("localhost") > oSMTP.sendmail("subversion (AT) leafe .D.O.T com", addr, msg) > > except StandardError, e: > open("/tmp/svn-error", "w").write("%s\n\n%s" % (e, str(sys.argv) )) > > - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - > > -- Ed Leafe > -- http://leafe.com > -- http://dabodev.com > > > > > [excessive quoting removed by server]
©2006 Ted Roche |