Re: [Twisted-Python] "local" semantics soughtin twisted.protocols.smtp.sendmail

JP, Glad that I was able to help out. Any guess as to what the original author meant by "local"? By using \n to delimit new lines, isn't that essentially saying the same thing as the oringal author? Perhaps of interest, the way I arrived at this nuance in the documentation is that a project I'm working on requires a node running an SMTP server to receive mail and then parse the contents of each mail message I'm sending with my Twisted application. Each line in the body of a mail message I'm sending contains API key, value pairs that are parsed by software on the node. I originally used the built-in Python smtplib.server.sendmail() method, and in order for it to work with the parsing software on the remote node, I had to end each line with a carriage return and a line feed as in: key=value\r\n key2=value2\r\n However, what I found different is that the node's parsing software didn't like it when I'd send mail as in the above example (with carriage return and line feed) via the Twisted SMTP module equivalent. To remedy this, I just had to remove the carriage returns, so its no big deal. But I am still curious as to why Python's sendmail eats the /r/n and why not with the Twisted equivalent. Perhaps just a silly nit pick but perhaps there is a deeper logical reasoning to this (I.e., could Twisted be making an improvement on the Python smtplib)? Thanks for any further insight. -Serg
From: Jp Calderone <exarkun@divmod.com> Reply-To: Twisted discussion stuff <twisted-python@twistedmatrix.com> To: Twisted discussion stuff <twisted-python@twistedmatrix.com> Subject: Re: [Twisted-Python] "local" semantics soughtin twisted.protocols.smtp.sendmail Date: Tue, 27 Jul 2004 15:15:31 -0400
Sergio Trejo wrote:
The API documentation for twisted.protocols.smtp.sendmail method states that the incoming msg parameter ((a string or a file object) must contain contain lines that end with a line feed character because, verbatim: "Line endings must be local (I.e., '\n')" ... the URL that I'm quoting from is http://www.twistedmatrix.com/documents/current/api/ twisted.protocols.smtp.html#sendmail
I am curious what is meant by the word "local" to describe the use of line endings in the API documentation. Does local mean something specific to an operating system of which the Python interpreter is compiled for and runs on top of (and if so, doesn't that break the philosophy of Python which is mostly OS agnostic)?
The documentation is wrong. Use \n to delimit newlines. I'll go fix the docs in SVN. Thanks for pointing this out.
Jp
Sergio
_________________________________________________________________ Add photos to your e-mail with MSN 8. Get 2 months FREE*. http://join.msn.com/?page=features/featuredemail

Sergio Trejo wrote:
JP,
Glad that I was able to help out. Any guess as to what the original author meant by "local"? By using \n to delimit new lines, isn't that essentially saying the same thing as the oringal author?
The original author of the doc strings seems to have been either Andrew Bennetts or Brian Warner. Perhaps one of them can shed some light on the reasoning behind the original phrasing. The wording indicated to me that the platform's native newline convention should be used, e.g., \r\n on Windows, \r on MacOS (pre-X), and \n on POSIX. Twisted's SMTP code only expects and only handles correctly \n. Jp
participants (2)
-
Jp Calderone
-
Sergio Trejo