public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
From: "Brian Dolbec" <brian.dolbec@gmail.com>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] proj/gentoo-keys:master commit in: gkeys-ldap/gkeyldap/
Date: Thu, 25 Dec 2014 20:43:09 +0000 (UTC)	[thread overview]
Message-ID: <1419534482.a57687cb1d083e056bfbefad55d69f5607bffd1c.dol-sen@gentoo> (raw)

commit:     a57687cb1d083e056bfbefad55d69f5607bffd1c
Author:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Thu Dec 25 19:08:02 2014 +0000
Commit:     Brian Dolbec <brian.dolbec <AT> gmail <DOT> com>
CommitDate: Thu Dec 25 19:08:02 2014 +0000
URL:        http://sources.gentoo.org/gitweb/?p=proj/gentoo-keys.git;a=commit;h=a57687cb

gkeys-ldap: Pass in our logger to LdapConnect class

---
 gkeys-ldap/gkeyldap/connect.py | 18 +++++++++---------
 gkeys-ldap/gkeyldap/search.py  |  2 +-
 2 files changed, 10 insertions(+), 10 deletions(-)

diff --git a/gkeys-ldap/gkeyldap/connect.py b/gkeys-ldap/gkeyldap/connect.py
index 74e393c..6c80e4f 100644
--- a/gkeys-ldap/gkeyldap/connect.py
+++ b/gkeys-ldap/gkeyldap/connect.py
@@ -14,15 +14,15 @@ except ImportError:
         raise
 
 
-from gkeys.log import logger
 from gkeyldap.config import default_server
 
 class LdapConnect(object):
     '''Class to connect on the configured LDAP server'''
 
-    def __init__(self, server=None):
+    def __init__(self, server=None, logger=None):
         self.server = server or default_server
-        logger.debug('LdapConnect: __init__; server...: %s' % self.server)
+        self.logger = logger
+        self.logger.debug('LdapConnect: __init__; server...: %s' % self.server)
         self.ldap_connection = None
 
     def connect(self, server=None, action='LDAP'):
@@ -30,21 +30,21 @@ class LdapConnect(object):
 
         @param server: string URI path for the LDAP server
         '''
-        logger.info("%s... Establishing connection" % action)
+        self.logger.info("%s... Establishing connection" % action)
         if server:
             self.server = server
-            logger.debug('LdapConnect: connect; new server: %s' % self.server)
+            self.logger.debug('LdapConnect: connect; new server: %s' % self.server)
         try:
             self.ldap_connection = ldap.initialize(self.server)
             self.ldap_connection.set_option(ldap.OPT_X_TLS_DEMAND, True)
             self.ldap_connection.start_tls_s()
             self.ldap_connection.simple_bind_s()
         except Exception as e:
-            logger.error(
+            self.logger.error(
                 'LdapConnect: connect; failed to connect to server: %s' % self.server)
-            logger.error("Exception was: %s" % str(e))
-            logger.error("Aborting %s... Connection failed" % action)
+            self.logger.error("Exception was: %s" % str(e))
+            self.logger.error("Aborting %s... Connection failed" % action)
             return False
-        logger.debug(
+        self.logger.debug(
             'LdapConnect: connect; connection: %s' % self.ldap_connection)
         return self.ldap_connection

diff --git a/gkeys-ldap/gkeyldap/search.py b/gkeys-ldap/gkeyldap/search.py
index 708c2e2..1bce9e1 100644
--- a/gkeys-ldap/gkeyldap/search.py
+++ b/gkeys-ldap/gkeyldap/search.py
@@ -27,7 +27,7 @@ class LdapSearch(object):
         self.logger = logger
         self.logger.debug('LdapSearch: __init__; fields...: %s' % self.fields)
         self.logger.debug('LdapSearch: __init__; criteria.: %s' % self.criteria)
-        self.ldap_connection = LdapConnect().connect(action='Search')
+        self.ldap_connection = LdapConnect(logger=self.logger).connect(action='Search')
         self.status = True
         if not self.ldap_connection:
             self.status = False


             reply	other threads:[~2014-12-25 20:43 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-12-25 20:43 Brian Dolbec [this message]
  -- strict thread matches above, loose matches on Subject: below --
2018-07-07 14:05 [gentoo-commits] proj/gentoo-keys:master commit in: gkeys-ldap/gkeyldap/ Brian Dolbec
2016-12-23 19:55 Brian Dolbec
2015-05-31  5:03 Brian Dolbec
2015-03-24  3:13 Brian Dolbec
2015-03-17 19:51 Brian Dolbec
2015-02-11 17:37 Brian Dolbec
2015-01-05 23:12 Brian Dolbec
2015-01-05 23:12 Brian Dolbec
2015-01-05 23:12 Brian Dolbec
2015-01-05 23:12 Brian Dolbec
2014-12-26 18:37 Brian Dolbec
2014-12-25 20:43 Brian Dolbec
2014-12-25 20:43 Brian Dolbec
2014-12-25 20:43 Brian Dolbec
2014-12-25 20:43 Brian Dolbec
2014-12-25 20:43 Brian Dolbec
2014-12-25 20:43 Brian Dolbec
2014-12-22 23:11 Brian Dolbec

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1419534482.a57687cb1d083e056bfbefad55d69f5607bffd1c.dol-sen@gentoo \
    --to=brian.dolbec@gmail.com \
    --cc=gentoo-commits@lists.gentoo.org \
    --cc=gentoo-dev@lists.gentoo.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox