[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

Re: [PATCH] Python mailer hook script for Windows (2nd attempt)

From: Branko Čibej <brane_at_xbc.nu>
Date: 2004-12-22 12:19:12 CET

Prucha, Brett A wrote:

>A patch for tools/hook-scripts/mailer/mailer.py adding os specific cases so it will work for Windows
>* If the subject line is longer than 200 characters truncate the subject
> and add ... to the end. Exchange server was not sending out the email
> because the subject line was too long.
>* Added windows specific cases for SMTPOutput, StandardOutput and
> PipeOutput. The PipeOutput was tested using IndigoMail
> (http://www.indigostar.com/sendmail.htm) where mail_command in the conf
> file was "sendmail.exe -t"
Actually, I'd just forbid piping to any kind of sendmail program on
Windows. You don't need it, since you can use Python's mail class and
use SMTP (even if you do use some kind of sendmail clone, you can SMTP
to localhost).

Looking at the patch below, the number of "if ...win32" tests gives me
the shudders.
-1, all those conditionals can be avoided if you use an OS-specific
helper class.

>+if sys.platform == "win32":
>+ def escape_shell_arg(str):
>+ str = string.replace(str, '"', '"^""')
>+ if re.search("[ ,\t]", str) != None:
Wha's that comma doing in the regular expression pattern? Why would you
quote parameters that contain a comma?

>+ return "\"" + str + "\""
>+ else:
>+ return str

-- Brane

To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Wed Dec 22 12:25:52 2004

This is an archived mail posted to the Subversion Dev mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.