homepage

This issue tracker has been migrated to GitHub , and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: smtpd.py: channel should be passed to process_message
Type: enhancement Stage: resolved
Components: email, Library (Lib) Versions: Python 3.6
process
Status: closed Resolution: wont fix
Dependencies: Superseder:
Assigned To: Nosy List: CuriousLearner, barry, lpolzer, r.david.murray
Priority: normal Keywords: easy, patch

Created on 2013年11月21日 10:56 by lpolzer, last changed 2022年04月11日 14:57 by admin. This issue is now closed.

Pull Requests
URL Status Linked Edit
PR 5050 closed CuriousLearner, 2017年12月30日 14:41
Messages (5)
msg203609 - (view) Author: Leslie P. Polzer (lpolzer) Date: 2013年11月21日 10:56
process_message needs to have access to the channel state since it needs to make decisions based on the authentication or transport associated with the channel. It should be either the first or the last arg.
I can provide a patch for this. Should backwards compatibility be achieved by using the inspect module to check the signature of process_message and call it accordingly?
msg204366 - (view) Author: R. David Murray (r.david.murray) * (Python committer) Date: 2013年11月25日 17:13
I think this is reasonable. A patch would be welcome.
You could use inspect. When I had to do something similar I just did the call inside a try/except, caught TypeError and retried without the extra argument. See the __init__ of email.feedparser.FeedParser. I don't know which approach is better; although, with the new signature support in 3.4 perhaps inspecting the signature is better.
Another approach would be to designate a new method name for the new signature, and use hasattr to decide which to call. That's actually a bit more consistent with the way the SMTPChannel works.
msg243421 - (view) Author: R. David Murray (r.david.murray) * (Python committer) Date: 2015年05月17日 18:46
At this point (3.5) we have settled on having process_message be required to have a **kwargs parameter in its signature in order to support new features (ex: enable_SMTPUTF8). So the solution here would be to use inspect.signature to find out if process_message has a **kwargs parameter (kind=VAR_KEYWORD), and if so to supply a 'channel' keyword and value.
msg307954 - (view) Author: Sanyam Khurana (CuriousLearner) * (Python triager) Date: 2017年12月10日 10:28
Leslie, would you like to work on a patch for this?
msg309744 - (view) Author: Barry A. Warsaw (barry) * (Python committer) Date: 2018年01月10日 00:47
I'm going to close this as won't fix since smtpd.py is deprecated, and there's little chance that folks are still interested in working on it. See aiosmtpd as a much better third party replacement.
History
Date User Action Args
2022年04月11日 14:57:53adminsetgithub: 63877
2018年01月10日 00:47:18barrysetstatus: open -> closed
resolution: wont fix
messages: + msg309744

stage: patch review -> resolved
2017年12月30日 14:41:16CuriousLearnersetkeywords: + patch
stage: needs patch -> patch review
pull_requests: + pull_request4931
2017年12月10日 10:28:52CuriousLearnersetnosy: + CuriousLearner
messages: + msg307954
2015年05月17日 18:46:54r.david.murraysetkeywords: + easy

stage: needs patch
messages: + msg243421
versions: + Python 3.6, - Python 3.5
2013年11月25日 17:13:38r.david.murraysetmessages: + msg204366
versions: + Python 3.5, - Python 3.4
2013年11月21日 10:56:50lpolzercreate

AltStyle によって変換されたページ (->オリジナル) /