Skip to content

Commit 60b761b

Browse files
jdufresneencukou
authored andcommitted
Remove long deprecated functions ldap.open() and ldap.init()
The functions have been deprecated since at least 2011. That has been lots of time for library users to see the warning and update calling code. #124
1 parent 9a74c29 commit 60b761b

File tree

3 files changed

+5
-53
lines changed

3 files changed

+5
-53
lines changed

Doc/reference/ldap.rst

Lines changed: 4 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -67,28 +67,6 @@ This module defines the following functions:
6767

6868
:rfc:`4516` - Lightweight Directory Access Protocol (LDAP): Uniform Resource Locator
6969

70-
.. py:function:: open(host [, port=PORT]) -> LDAPObject object
71-
72-
Opens a new connection with an LDAP server, and return an LDAP object (see
73-
:ref:`ldap-objects`) used to perform operations on that server. *host* is a
74-
string containing solely the host name. *port* is an integer specifying the
75-
port where the LDAP server is listening (default is 389).
76-
77-
.. deprecated:: 3.0
78-
79-
``ldap.open()`` is deprecated. It will be removed in version 3.1. Use
80-
:func:`ldap.initialize()` with a URI like ``'ldap://<hostname>:<port>'``
81-
instead.
82-
83-
.. py:function:: init(host [, port=PORT]) -> LDAPObject object
84-
85-
Alias of :func:`ldap.open()`.
86-
87-
.. deprecated:: 3.0
88-
89-
``ldap.init()`` is deprecated. It will be removed in version 3.1. Use
90-
:func:`ldap.initialize()` with a URI like ``'ldap://<hostname>:<port>'``
91-
instead.
9270

9371
.. py:function:: get_option(option) -> int|string
9472
@@ -100,6 +78,10 @@ This module defines the following functions:
10078
This function sets the value of the global option specified by *option* to
10179
*invalue*.
10280

81+
.. versionchanged:: 3.1
82+
83+
The deprecated functions ``ldap.init()`` and ``ldap.open()`` were removed.
84+
10385

10486
.. _ldap-constants:
10587

Lib/ldap/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ def release(self):
9191
# Create module-wide lock for serializing all calls into underlying LDAP lib
9292
_ldap_module_lock = LDAPLock(desc='Module wide')
9393

94-
from ldap.functions import open,initialize,init,get_option,set_option,escape_str,strf_secs,strp_secs
94+
from ldap.functions import initialize,get_option,set_option,escape_str,strf_secs,strp_secs
9595

9696
from ldap.ldapobject import NO_UNIQUE_ENTRY, LDAPBytesWarning
9797

Lib/ldap/functions.py

Lines changed: 0 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -85,36 +85,6 @@ def initialize(uri,trace_level=0,trace_file=sys.stdout,trace_stack_limit=None, b
8585
return LDAPObject(uri,trace_level,trace_file,trace_stack_limit,bytes_mode)
8686

8787

88-
def open(host,port=389,trace_level=0,trace_file=sys.stdout,trace_stack_limit=None,bytes_mode=None):
89-
"""
90-
Return LDAPObject instance by opening LDAP connection to
91-
specified LDAP host
92-
93-
Parameters:
94-
host
95-
LDAP host and port, e.g. localhost
96-
port
97-
integer specifying the port number to use, e.g. 389
98-
trace_level
99-
If non-zero a trace output of LDAP calls is generated.
100-
trace_file
101-
File object where to write the trace output to.
102-
Default is to use stdout.
103-
bytes_mode
104-
Whether to enable "bytes_mode" for backwards compatibility under Py2.
105-
"""
106-
import warnings
107-
warnings.warn(
108-
'ldap.open() is deprecated. Use ldap.initialize() instead. It will be '
109-
'removed in python-ldap 3.1.',
110-
category=DeprecationWarning,
111-
stacklevel=2,
112-
)
113-
return initialize('ldap://%s:%d' % (host,port),trace_level,trace_file,trace_stack_limit,bytes_mode)
114-
115-
init = open
116-
117-
11888
def get_option(option):
11989
"""
12090
get_option(name) -> value

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