Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Fix issue with python2.5 missing ssl (no ssl support if package is no…

…t installed)
  • Loading branch information...
commit f96352593693fda1f76a7186552eac5825e21772 1 parent 7110b44
@reingart reingart authored
Showing with 7 additions and 2 deletions.
  1. +7 −2 pg8000/protocol.py
View
9 pg8000/protocol.py
@@ -30,7 +30,10 @@
__author__ = "Mathieu Fenniak"
import socket
-import ssl as sslmodule
+try:
+ import ssl as sslmodule
+except ImportError:
+ sslmodule = None
import select
import threading
import struct
@@ -945,8 +948,10 @@ def __init__(self, unix_sock=None, host=None, port=5432, socket_timeout=60, ssl=
self._send(SSLRequest())
self._flush()
resp = self._sock.recv(1)
- if resp == 'S':
+ if resp == 'S' and sslmodule is not None:
self._sock = sslmodule.wrap_socket(self._sock)
+ elif sslmodule is None:
+ raise InterfaceError("SSL required but ssl module not available in this python installation")
else:
raise InterfaceError("server refuses SSL")
finally:
Please sign in to comment.
Something went wrong with that request. Please try again.