Skip to content

Commit 06be5eb

Browse files
jdufresneencukou
authored andcommitted
Make SlapdObject.root_dn a property
Allows overriding SlapdObject.suffix or SlapdObject.root_cn without also requiring root_dn be defined. It is now computed from the existing values at runtime. The result is an easier to use SlapdObject class. python-ldap#195
1 parent 4a6a719 commit 06be5eb

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

Lib/slapdtest/_slapdtest.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,6 @@ class SlapdObject(object):
169169
database = 'mdb'
170170
suffix = 'dc=slapd-test,dc=python-ldap,dc=org'
171171
root_cn = 'Manager'
172-
root_dn = 'cn=%s,%s' % (root_cn, suffix)
173172
root_pw = 'password'
174173
slapd_loglevel = 'stats stats2'
175174
local_host = '127.0.0.1'
@@ -232,6 +231,10 @@ def __init__(self):
232231
self.clientcert = os.path.join(HERE, 'certs/client.pem')
233232
self.clientkey = os.path.join(HERE, 'certs/client.key')
234233

234+
@property
235+
def root_dn(self):
236+
return 'cn={self.root_cn},{self.suffix}'.format(self=self)
237+
235238
def _find_commands(self):
236239
self.PATH_LDAPADD = self._find_command('ldapadd')
237240
self.PATH_LDAPDELETE = self._find_command('ldapdelete')

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