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

AttributeError: 'module' object has no attribute 'SSLContext' #2789

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions flask/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -670,7 +670,7 @@ def convert(self, value, param, ctx):

obj = import_string(value, silent=True)

if sys.version_info < (2, 7):
if sys.version_info < (2, 7, 9):
if obj:
return obj
else:
Expand All @@ -687,7 +687,7 @@ def _validate_key(ctx, param, value):
cert = ctx.params.get('cert')
is_adhoc = cert == 'adhoc'

if sys.version_info < (2, 7):
if sys.version_info < (2, 7, 9):
is_context = cert and not isinstance(cert, (text_type, bytes))
else:
is_context = isinstance(cert, ssl.SSLContext)
Expand Down
4 changes: 2 additions & 2 deletions tests/test_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -521,12 +521,12 @@ def test_run_cert_import(monkeypatch):
run_command.make_context('run', ['--cert', 'not_here'])

# not an SSLContext
if sys.version_info >= (2, 7):
if sys.version_info >= (2, 7, 9):
with pytest.raises(click.BadParameter):
run_command.make_context('run', ['--cert', 'flask'])

# SSLContext
if sys.version_info < (2, 7):
if sys.version_info < (2, 7, 9):
ssl_context = object()
else:
ssl_context = ssl.SSLContext(ssl.PROTOCOL_SSLv23)
Expand Down