From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) by finch.gentoo.org (Postfix) with ESMTP id 7A0B51389E2 for ; Thu, 25 Dec 2014 20:43:14 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id ED124E095B; Thu, 25 Dec 2014 20:43:12 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id 41923E0960 for ; Thu, 25 Dec 2014 20:43:12 +0000 (UTC) Received: from oystercatcher.gentoo.org (oystercatcher.gentoo.org [148.251.78.52]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id 37703340554 for ; Thu, 25 Dec 2014 20:43:11 +0000 (UTC) Received: from localhost.localdomain (localhost [127.0.0.1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id A8BFCD5D0 for ; Thu, 25 Dec 2014 20:43:09 +0000 (UTC) From: "Brian Dolbec" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Brian Dolbec" Message-ID: <1419534171.1f8276dd70e3231af0bdf93fc0e822fb90ae5571.dol-sen@gentoo> Subject: [gentoo-commits] proj/gentoo-keys:master commit in: gkeys-ldap/gkeyldap/ X-VCS-Repository: proj/gentoo-keys X-VCS-Files: gkeys-ldap/gkeyldap/actions.py gkeys-ldap/gkeyldap/search.py X-VCS-Directories: gkeys-ldap/gkeyldap/ X-VCS-Committer: dol-sen X-VCS-Committer-Name: Brian Dolbec X-VCS-Revision: 1f8276dd70e3231af0bdf93fc0e822fb90ae5571 X-VCS-Branch: master Date: Thu, 25 Dec 2014 20:43:09 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org X-Archives-Salt: 330b9bc4-aa94-44eb-8aa1-fee917ba0945 X-Archives-Hash: a9123f506f2219060e51cdf32d6f1860 commit: 1f8276dd70e3231af0bdf93fc0e822fb90ae5571 Author: Brian Dolbec gentoo org> AuthorDate: Thu Dec 25 19:02:51 2014 +0000 Commit: Brian Dolbec gmail com> CommitDate: Thu Dec 25 19:02:51 2014 +0000 URL: http://sources.gentoo.org/gitweb/?p=proj/gentoo-keys.git;a=commit;h=1f8276dd gkeys-ldap: Pass in our logger instance to LdapSearch class --- gkeys-ldap/gkeyldap/actions.py | 4 ++-- gkeys-ldap/gkeyldap/search.py | 16 ++++++++-------- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/gkeys-ldap/gkeyldap/actions.py b/gkeys-ldap/gkeyldap/actions.py index cea4648..c0f891f 100644 --- a/gkeys-ldap/gkeyldap/actions.py +++ b/gkeys-ldap/gkeyldap/actions.py @@ -56,7 +56,7 @@ class Actions(object): def ldapsearch(self, args): - l = LdapSearch() + l = LdapSearch(logger=self.logger) self.logger.debug("MAIN: _action_ldapsearch; args = %s" % str(args)) self.output("Search... Establishing connection\n") if not l.status: @@ -75,7 +75,7 @@ class Actions(object): def updateseeds(self, args): - l = LdapSearch() + l = LdapSearch(logger=self.logger) self.logger.debug("MAIN: _action_updateseeds; args = %s" % str(args)) self.output("Search... Establishing connection") if not l.status: diff --git a/gkeys-ldap/gkeyldap/search.py b/gkeys-ldap/gkeyldap/search.py index 81a9048..708c2e2 100644 --- a/gkeys-ldap/gkeyldap/search.py +++ b/gkeys-ldap/gkeyldap/search.py @@ -16,17 +16,17 @@ except ImportError: from gkeyldap.config import default_criteria, default_fields, UID from gkeyldap.connect import LdapConnect -from gkeys.log import logger class LdapSearch(object): '''Class to perform searches on the configured LDAP server ''' - def __init__(self, fields=None, criteria=None): + def __init__(self, fields=None, criteria=None, logger=None): self.fields = fields or default_fields self.criteria = criteria or default_criteria - logger.debug('LdapSearch: __init__; fields...: %s' % self.fields) - logger.debug('LdapSearch: __init__; criteria.: %s' % self.criteria) + 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.status = True if not self.ldap_connection: @@ -36,19 +36,19 @@ class LdapSearch(object): '''Perform the LDAP search ''' if not target: - logger.debug('LdapSearch: search; invalid target: "%s"' % target) + self.logger.debug('LdapSearch: search; invalid target: "%s"' % target) return {} if not fields: fields = self.fields else: - logger.debug('LdapSearch: search; new fields: %s' % str(fields)) + self.logger.debug('LdapSearch: search; new fields: %s' % str(fields)) if not criteria: criteria = self.criteria else: - logger.debug('LdapSearch: search; new criteria: %s' % criteria) + self.logger.debug('LdapSearch: search; new criteria: %s' % criteria) results = self.ldap_connection.search_s(criteria, ldap.SCOPE_ONELEVEL, search_field % target, fields) - #logger.debug('LdapSearch: search; result = %s' % str(results)) + #self.logger.debug('LdapSearch: search; result = %s' % str(results)) return results