fix byte-array / str
python3 returns byte-arrays instead of strings for ldap-data in ContextCSNs, which makes the listcomprehension fail with a TypeError when using the --serverID flag like so: CSN = [s for s in contextCSNs if sub in s] TypeError: a bytes-like object is required, not 'str' explicitly encoding 'sub' to byte-array, not sure if this is best way, but seems to work well enough.
This commit is contained in:
parent
5ce72df6dc
commit
2f6d97f761
1 changed files with 1 additions and 1 deletions
|
@ -323,7 +323,7 @@ class LdapServer(object):
|
||||||
if serverid is False:
|
if serverid is False:
|
||||||
return contextCSNs[0]
|
return contextCSNs[0]
|
||||||
csnid = str(format(serverid, 'X')).zfill(3)
|
csnid = str(format(serverid, 'X')).zfill(3)
|
||||||
sub = '#%s#' % csnid
|
sub = str.encode('#%s#' % csnid, encoding="ascii", errors="replace")
|
||||||
CSN = [s for s in contextCSNs if sub in s]
|
CSN = [s for s in contextCSNs if sub in s]
|
||||||
if not CSN:
|
if not CSN:
|
||||||
logging.error(
|
logging.error(
|
||||||
|
|
Loading…
Reference in a new issue