Skip to content

Commit a40ee18

Browse files
author
stroeder
committed
no global _LOG_LEVEL, make pylint happy
1 parent b6e058e commit a40ee18

File tree

1 file changed

+11
-13
lines changed

1 file changed

+11
-13
lines changed

Lib/slapdtest.py

Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
55
See http://www.python-ldap.org/ for details.
66
7-
\$Id: slapdtest.py,v 1.9 2017/04/28 07:30:58 stroeder Exp $
7+
$Id: slapdtest.py,v 1.10 2017/04/28 08:59:09 stroeder Exp $
88
99
Python compability note:
1010
This module only works with Python 2.7.x since
@@ -21,16 +21,6 @@
2121
import unittest
2222
import urllib
2323

24-
# determine log level
25-
try:
26-
_LOG_LEVEL = os.environ['LOGLEVEL']
27-
try:
28-
_LOG_LEVEL = int(_LOG_LEVEL)
29-
except ValueError:
30-
pass
31-
except KeyError:
32-
_LOG_LEVEL = logging.WARN
33-
3424
# a template string for generating simple slapd.conf file
3525
SLAPD_CONF_TEMPLATE = r"""
3626
serverID %(serverid)s
@@ -54,14 +44,20 @@
5444

5545
def combined_logger(
5646
log_name,
57-
log_level=_LOG_LEVEL,
47+
log_level=logging.WARN,
5848
sys_log_format='%(levelname)s %(message)s',
5949
console_log_format='%(asctime)s %(levelname)s %(message)s',
6050
):
6151
"""
6252
Returns a combined SysLogHandler/StreamHandler logging instance
6353
with formatters
6454
"""
55+
if 'LOGLEVEL' in os.environ:
56+
log_level = os.environ['LOGLEVEL']
57+
try:
58+
log_level = int(log_level)
59+
except ValueError:
60+
pass
6561
# for writing to syslog
6662
new_logger = logging.getLogger(log_name)
6763
if sys_log_format:
@@ -81,6 +77,7 @@ def combined_logger(
8177
new_logger.setLevel(log_level)
8278
return new_logger # end of combined_logger()
8379

80+
8481
class SlapdObject(object):
8582
"""
8683
Controller class for a slapd instance, OpenLDAP's server.
@@ -247,8 +244,8 @@ def start(self):
247244
"""
248245
Starts the slapd server process running, and waits for it to come up.
249246
"""
247+
250248
if self._proc is None:
251-
config_path = None
252249
# prepare directory structure
253250
self._cleanup_rundir()
254251
self._setup_rundir()
@@ -346,6 +343,7 @@ class SlapdTestCase(unittest.TestCase):
346343

347344
server_class = SlapdObject
348345
server = None
346+
ldap_object_class = None
349347

350348
def _open_ldap_conn(self, who=None, cred=None):
351349
"""

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy