Skip to content
Snippets Groups Projects
Commit 361c6de3 authored by Krishnaveni's avatar Krishnaveni
Browse files

added code to change str to bytes in createPersonAttrs to be compatible with Python3

parent cd8e3f5d
No related branches found
No related tags found
No related merge requests found
2023-08-22 18:51:26 2023-08-23 14:20:17
\ No newline at end of file \ No newline at end of file
...@@ -24,7 +24,7 @@ class SUPR_LDAP: ...@@ -24,7 +24,7 @@ class SUPR_LDAP:
if all_projects or persons_modified: if all_projects or persons_modified:
# Get Logging File Handler # Get Logging File Handler
self.logger = setup_log(self.__class__.__name__, "ldap") self.logger = setup_log(self.__class__.__name__, settings.LOG_FILE)
# LDAP connection # LDAP connection
self.l = None # TODO: Give this variable a better name self.l = None # TODO: Give this variable a better name
...@@ -283,6 +283,8 @@ class SUPR_LDAP: ...@@ -283,6 +283,8 @@ class SUPR_LDAP:
else: else:
attrsPerson['uid'] = self.getUID(m) attrsPerson['uid'] = self.getUID(m)
attrsPerson = {key:[v.encode("utf-8") if type(v) == str else v for v in values] for key, values in attrsPerson.items()}
return attrsPerson return attrsPerson
def personChanged(self, result_data, attrsPerson): def personChanged(self, result_data, attrsPerson):
...@@ -487,7 +489,7 @@ class SUPR_LDAP: ...@@ -487,7 +489,7 @@ class SUPR_LDAP:
attrsPerson = self.createPersonAttrs(m, uidNumber) attrsPerson = self.createPersonAttrs(m, uidNumber)
personDN = "uid=" + attrsPerson['uid'] + "," + settings.peopleDN personDN = "uid=" + str(attrsPerson['uid']) + "," + settings.peopleDN
if(result_data and self.personChanged(result_data, attrsPerson)): if(result_data and self.personChanged(result_data, attrsPerson)):
self.l.delete_s(personDN) self.l.delete_s(personDN)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment