-
-
Notifications
You must be signed in to change notification settings - Fork 30.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Newer reply format for imap commands in imaplib.py #45085
Comments
|
If the fetch command does not contain literal, the result is [ '1 (FLAGS (\\Seen) UID 1 RFC822.SIZE 26435)', If the fetch command contains literal, the result is [ ('1 (FLAGS (\\Seen) UID 1 RFC822.SIZE 26435', 'header literal'), First off, the number of elements in the reply becomes twice of non-literal fetch command. Secondly, to parse the attribute string like "(FLAGS (\\Seen) UID 1 RFC822.SIZE 26435)" , one must check the first and last character to be '(' and ')' for the correctness of reply. With the second type of reply / the reply with literal, the reply string needs to be reconstructed out of the first element of tuple in an element, the subsequent element by appending them. If the number of elements in the reply matches with the number of mails fetched, I can deal with the reply a lot easier. As the shape of fetch command output is very different depending on literal, the use of fetch() is too hard for its good. Therefore, I propose the new response format. And each entry is This allows that you can get to the entry reply uniformly regardless of whether or not the query of fetch with or without literal response. Since the proposed response format is not compatible with existing format, additional proposal is to let the user of imaplib.py to designate the response format, as existing format as 1, and the new format as 2. I have attached a patch for the proposed change. |
|
I overlooked that IMAP4_SSL needs the same enhancement. IMAP4_SSL's constructor should look like as follows. def __init__(self, host = '', port = IMAP4_SSL_PORT, keyfile = None, certfile = None, response_format = 1):
self.keyfile = keyfile
self.certfile = certfile
IMAP4.__init__(self, host, port, response_format) |
|
Is there any interest in the change proposed here? If not I'll close in a few weeks time. Note the patch does not include doc or unit test changes. |
|
I'm not sure what "fetch command does not contain literal" means. If the OP can clarify, I'd be interested in this issue. |
|
Someday I intend to pay a constructive visit to imaplib, so yes please leave this open. |


Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: