Skip to content

Commit db60bf1

Browse files
stroederencukou
authored andcommitted
removed all dependencies on modules string and types
1 parent 8622217 commit db60bf1

5 files changed

Lines changed: 17 additions & 18 deletions

File tree

CHANGES

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ Modules/
1010
* _ldap.__author__ and _ldap.__license__ also set from ldap.pkginfo
1111

1212
Lib/
13+
* removed all dependencies on modules string and types
1314
* new global constant ldap.LIBLDAP_API_INFO
1415
* right after importing _ldap there is a call into libldap to initialize it
1516
* method .decodeControlValue() of SSSResponseControl and VLVResponseControl

Demo/simplebrowse.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
#
66

77
import ldap
8-
import string
98
from traceback import print_exc
109

1110
url = "ldap://ldap.openldap.org/"
@@ -71,8 +70,8 @@
7170
if arg == '-':
7271
lastdn,dn = dn,lastdn
7372
elif arg == '..':
74-
dn = string.join(ldap.explode_dn(dn)[1:], ",")
75-
dn = string.strip(dn)
73+
dn = ldap.explode_dn(dn)[1:].join(",")
74+
dn = dn.strip()
7675
else:
7776
try:
7877
i = int(arg)

Lib/ldap/modlist.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111
from ldap import __version__
1212

13-
import string,ldap,ldap.cidict
13+
import ldap,ldap.cidict
1414

1515

1616
def list_dict(l,case_insensitive=0):
@@ -31,10 +31,10 @@ def list_dict(l,case_insensitive=0):
3131

3232
def addModlist(entry,ignore_attr_types=None):
3333
"""Build modify list for call of method LDAPObject.add()"""
34-
ignore_attr_types = list_dict(map(string.lower,(ignore_attr_types or [])))
34+
ignore_attr_types = list_dict(map(str.lower,(ignore_attr_types or [])))
3535
modlist = []
3636
for attrtype in entry.keys():
37-
if ignore_attr_types.has_key(string.lower(attrtype)):
37+
if ignore_attr_types.has_key(str.lower(attrtype)):
3838
# This attribute type is ignored
3939
continue
4040
# Eliminate empty attr value strings in list
@@ -66,14 +66,14 @@ def modifyModlist(
6666
List of attribute type names for which comparison will be made
6767
case-insensitive
6868
"""
69-
ignore_attr_types = list_dict(map(string.lower,(ignore_attr_types or [])))
70-
case_ignore_attr_types = list_dict(map(string.lower,(case_ignore_attr_types or [])))
69+
ignore_attr_types = list_dict(map(str.lower,(ignore_attr_types or [])))
70+
case_ignore_attr_types = list_dict(map(str.lower,(case_ignore_attr_types or [])))
7171
modlist = []
7272
attrtype_lower_map = {}
7373
for a in old_entry.keys():
74-
attrtype_lower_map[string.lower(a)]=a
74+
attrtype_lower_map[str.lower(a)]=a
7575
for attrtype in new_entry.keys():
76-
attrtype_lower = string.lower(attrtype)
76+
attrtype_lower = str.lower(attrtype)
7777
if ignore_attr_types.has_key(attrtype_lower):
7878
# This attribute type is ignored
7979
continue

Lib/ldif.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
'LDIFCopy',
2222
]
2323

24-
import urlparse,urllib,base64,re,types
24+
import urlparse,urllib,base64,re
2525

2626
try:
2727
from cStringIO import StringIO
@@ -193,9 +193,9 @@ def unparse(self,dn,record):
193193
# Start with line containing the distinguished name
194194
self._unparseAttrTypeandValue('dn',dn)
195195
# Dispatch to record type specific writers
196-
if isinstance(record,types.DictType):
196+
if isinstance(record,dict):
197197
self._unparseEntryRecord(record)
198-
elif isinstance(record,types.ListType):
198+
elif isinstance(record,list):
199199
self._unparseChangeRecord(record)
200200
else:
201201
raise ValueError('Argument record must be dictionary or list instead of %s' % (repr(record)))

setup.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
from distutils.core import setup, Extension
1313

1414
from ConfigParser import ConfigParser
15-
import sys,os,string,time
15+
import sys,os,time
1616

1717
sys.path.insert(0, os.path.join(os.getcwd(), 'Lib/ldap'))
1818
import pkginfo
@@ -36,15 +36,14 @@ class OpenLDAP2:
3636
if cfg.has_section('_ldap'):
3737
for name in dir(LDAP_CLASS):
3838
if cfg.has_option('_ldap', name):
39-
print name + ': ' + cfg.get('_ldap', name)
40-
setattr(LDAP_CLASS, name, string.split(cfg.get('_ldap', name)))
39+
setattr(LDAP_CLASS, name, cfg.get('_ldap', name).split())
4140

4241
for i in range(len(LDAP_CLASS.defines)):
4342
LDAP_CLASS.defines[i]=((LDAP_CLASS.defines[i],None))
4443

4544
for i in range(len(LDAP_CLASS.extra_files)):
46-
destdir, origfiles = string.split(LDAP_CLASS.extra_files[i], ':')
47-
origfileslist = string.split(origfiles, ',')
45+
destdir, origfiles = LDAP_CLASS.extra_files[i].split(':')
46+
origfileslist = origfiles.split(',')
4847
LDAP_CLASS.extra_files[i]=(destdir, origfileslist)
4948

5049
#-- Let distutils/setuptools do the rest

0 commit comments

Comments
 (0)