Skip to content
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

Allow more imap configuration via autofiler config #26

Merged
merged 2 commits into from
Nov 15, 2017

Conversation

digwanderlust
Copy link

This patch allows you to specify the port used for
your imap connection as well as specify a custom
CA file. This is useful if the company that setup
your imap server is using non standard ports
and/or has self signed certs.

the server.
he server.

You can also optionally provide the imap servers port and a custom CA file.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since you'll need to update this PR to make flake8 happy anyway, could you change "imap" to "IMAP" here, please?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yup, happy to change, also looks like I chopped off the t in the, I'll fix that as well. Other than flake8 are there any other linters you would like me to run this through?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The tests run by travis are sufficient, thanks!

@@ -113,15 +114,23 @@ def expunge(self):
def close(self):
"Close the connection, flushing any pending changes."


'/Users/olsenmo/Desktop/internal.pem'
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Was this literal string for debugging?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like something got pasted in the wrong window. Sorry about that, I'll remove.

self._conn = imapclient.IMAPClient(
cfg['server']['hostname'],
use_uid=True,
ssl=True,
port=cfg['server'].get('port'),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is passing None explicitly the same as the default for port? Or should we set the default explicitly in the get() call so we always pass a valid number?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The reason I used None instead of the default was that it allows the library we are calling the ability to change the default value (say if it became a different type for example). Also the default for this value varies depending on whether ssl is True or not. If we hand the "default" value then any changes that would make ssl optional in the future would need to be aware of this.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK. I'm asking about what the underlying library actually expects or supports. I don't have the library code handy to look at what it's doing with a value of None.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, that makes sense. Here is what the init definition looks like:

def __init__(self, host, port=None, use_uid=True, ssl=True, stream=False,
             ssl_context=None, timeout=None):

If port is None it will be set based on what the value of ssl is set to.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK, it sounds like None is fine as a default then. Thanks for verifying!

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No problem

Matt Olsen added 2 commits November 13, 2017 12:27
This patch allows you to specify the port used for
your imap connection as well as specify a custom
CA file. This is useful if the company that setup
your imap server is using non standard ports
and/or has self signed certs.
@dhellmann
Copy link
Member

I cleaned up the .eggs directory in a separate patch. Thanks for working on this!

@digwanderlust
Copy link
Author

Thanks for merging the change so quickly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants