trac-ticketlinks / trac /

Diff from to

File trac/

 from trac import __version__
 from trac.config import BoolOption, ExtensionOption, IntOption, Option
 from trac.core import *
-from trac.util.text import CRLF
+from trac.util.text import CRLF, fix_eol
 from trac.util.translation import _, deactivate, reactivate
         '(?:[a-zA-Z0-9_-]+\.)+' # labels (but also allow '_')
         '[a-zA-Z](?:[-a-zA-Z\d]*[a-zA-Z\d])?' # TLD
-eol_re = re.compile('\r?\n')
 class IEmailSender(Interface):
     def send(self, from_addr, recipients, message):
         # Ensure the message complies with RFC2822: use CRLF line endings
-        message = CRLF.join(eol_re.split(message))
+        message = fix_eol(message, CRLF)
         "Sending notification through SMTP at %s:%d to %s"
                       % (self.smtp_server, self.smtp_port, recipients))
     def send(self, from_addr, recipients, message):
         # Use native line endings in message
-        message = os.linesep.join(eol_re.split(message))
+        message = fix_eol(message, os.linesep)
 "Sending notification through sendmail at %s to %s"
                       % (self.sendmail_path, recipients))