From d1f800739f4335b16bbc24c1490c288255d5342e Mon Sep 17 00:00:00 2001
From: Chris McDonough <chrism@plope.com>
Date: Sun, 26 Feb 2012 02:58:00 -0500
Subject: [PATCH] fix use_tls flag

---
 CHANGES.txt                     | 6 ++++++
 ldappool/__init__.py            | 2 +-
 ldappool/tests/test_ldappool.py | 4 ++++
 3 files changed, 11 insertions(+), 1 deletion(-)
 create mode 100644 CHANGES.txt

diff --git a/CHANGES.txt b/CHANGES.txt
new file mode 100644
index 0000000..a7dcba1
--- /dev/null
+++ b/CHANGES.txt
@@ -0,0 +1,6 @@
+Next release
+------------
+
+- Fix ``use_tls`` flag to ConnectionManager; it previously was always set
+  ``False`` no matter what was passed.
+
diff --git a/ldappool/__init__.py b/ldappool/__init__.py
index 73c38e7..4d5319e 100644
--- a/ldappool/__init__.py
+++ b/ldappool/__init__.py
@@ -129,7 +129,7 @@ class ConnectionManager(object):
         self.bind = bind
         self.passwd = passwd
         self._pool_lock = RLock()
-        self.use_tls = False
+        self.use_tls = use_tls
         self.timeout = timeout
         self.connector_cls = connector_cls
         self.use_pool = use_pool
diff --git a/ldappool/tests/test_ldappool.py b/ldappool/tests/test_ldappool.py
index 07a4f08..da1f187 100644
--- a/ldappool/tests/test_ldappool.py
+++ b/ldappool/tests/test_ldappool.py
@@ -118,6 +118,10 @@ class LDAPWorker(threading.Thread):
 
 class TestLDAPSQLAuth(unittest.TestCase):
 
+    def test_ctor_args(self):
+        pool = ConnectionManager('ldap://localhost', use_tls=True)
+        self.assertEqual(pool.use_tls, True)
+
     def test_pool(self):
         dn = 'uid=adminuser,ou=logins,dc=mozilla'
         passwd = 'adminuser'