On 05.01.2011 14:00, danie...@apache.org wrote:
> Author: danielsh
> Date: Wed Jan  5 13:00:07 2011
> New Revision: 1055452
>
> URL: http://svn.apache.org/viewvc?rev=1055452&view=rev
> Log:
> Add some helpful headers to l10-report.py's output.
>
> * tools/po/l10n-report.py
>   (svn:keywords): Set to 'all'.
>   (_rev): New helper.
>   (main): Include a couple of extra headers.
>
> Modified:
>     subversion/trunk/tools/po/l10n-report.py   (contents, props changed)
>
> Modified: subversion/trunk/tools/po/l10n-report.py
> URL: 
> http://svn.apache.org/viewvc/subversion/trunk/tools/po/l10n-report.py?rev=1055452&r1=1055451&r2=1055452&view=diff
> ==============================================================================
> --- subversion/trunk/tools/po/l10n-report.py (original)
> +++ subversion/trunk/tools/po/l10n-report.py Wed Jan  5 13:00:07 2011
> @@ -1,5 +1,6 @@
>  #!/usr/bin/env python
>  #
> +# $Id$
>  #
>  # Licensed to the Apache Software Foundation (ASF) under one
>  # or more contributor license agreements.  See the NOTICE file
> @@ -39,6 +40,10 @@ import os
>  import re
>  import subprocess
>  
> +def _rev():
> +  dollar = "$Revision$"
> +  return int(re.findall('[0-9]+', dollar)[0]);
> +
>  def usage_and_exit(errmsg=None):
>      """Print a usage message, plus an ERRMSG (if provided), then exit.
>      If ERRMSG is provided, the usage message is printed to stderr and
> @@ -185,9 +190,16 @@ def main():
>          email_to = "To: %s" % to_email_id
>          email_sub = "Subject: [l10n] Translation status report for %s r%s" \
>                       % (branch_name, wc_version)
> +        x_headers = "".join([
> +          "X-Mailer: l10n-report.py r%ld\n" % _rev(),
> +          "Reply-To: d...@subversion.apache.org\n",
> +          "Mail-Followup-To: d...@subversion.apache.org\n",
> +          # 
> http://www.iana.org/assignments/auto-submitted-keywords/auto-submitted-keywords.xhtml
> +          "Auto-Submitted: auto-generated\n",
> +        ];
>  
> -        msg = "%s\n%s\n%s\n%s\n%s\n%s\n%s" % (email_from, email_to,\
> -              email_sub, title, format_head, format_line, body)
> +        msg = "\n".join((email_from, email_to, email_sub, x_headers,
> +                        title, format_head, format_line, body))
>  
>          server.sendmail(email_from, email_to, msg)
>          print("The report is sent to '%s' email id." % to_email_id)

RFC822 messages should properly have CRLF line endings, so I'd suggest
"\r\n".join(...) for both the headers and the body.

-- Brane

Reply via email to