Hi Kent - thanks for taking a look! Follow-up below: On Sun, Feb 15, 2009 at 12:20 PM, Kent Johnson <ken...@tds.net> wrote: > - put the main code in a main() function rather than splitting it > across the file.
That's a good idea - I will do that. Is it proper to create a def main() or just under: if __name__ == "__main__" > - the use of tmpfile is awkward, can you make the gmailme script take > its input in strings? that gmail script needs an actual file to attach ... or rather, the location of a file to attach ... would have to change something so it could take text that it could save as a file. but that would probably be better. > - I would use plain positional parameters to getMessage(), rather than > supplying defaults. > - the status dict could be built once, containing just the format strings, > e.g. > status = dict( > TestMessage = "This was a crazy test message! Woo hoo!", > RebuildStarted = "The rebuilding of %(mddevice)s has begun!", > # etc > } > > then you can build the message as > body = status.get(event, nomatch) % vars() > message = header + body + footer That last part I am not so clear on ... how does: body = status.get(event, nomatch) % vars() work ? Does it say, first look for "event" as a key and then, if it doesn't find a match with event,, use the "nomatch" key ? I was trying to do something like that but couldn't figure out how to make it work ... Thanks! > > Kent > _______________________________________________ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor