Skip to content
Snippets Groups Projects
Commit 3f1395c9 authored by Einar Largenius's avatar Einar Largenius
Browse files

Fix crash

The python3 versions of python-ldap requires using bytestrings in some
places, a feature not available in python2
parent 83a7b6f3
No related branches found
No related tags found
No related merge requests found
...@@ -599,20 +599,20 @@ class SUPR_LDAP: ...@@ -599,20 +599,20 @@ class SUPR_LDAP:
# ( Example 6012 - 6000 is the start range and 12 is the project id from SUPR ) # ( Example 6012 - 6000 is the start range and 12 is the project id from SUPR )
gidNumber = str(settings.gidNumberStart + p.id) gidNumber = str(settings.gidNumberStart + p.id)
groupDN = ("gidNumber=" + gidNumber + "," + settings.groupsDN).encode("utf-8") groupDN = "gidNumber=" + gidNumber + "," + settings.groupsDN
attrsGroup['objectclass'] = ['Swestore', 'posixgroup'] attrsGroup['objectclass'] = [b'Swestore', b'posixgroup']
attrsGroup['description'] = [str(p.id)] attrsGroup['description'] = [str(p.id).encode("utf-8")]
attrsGroup['piMemberID'] = str(settings.uidNumberStart + p.pi.id) attrsGroup['piMemberID'] = (str(settings.uidNumberStart + p.pi.id)).encode("utf-8")
attrsGroup['memberUID'] = memberUIDList attrsGroup['memberUID'] = [m.encode("utf-8") for m in memberUIDList]
attrsGroup['resourceID'] = resourceIDList attrsGroup['resourceID'] = [r.encode("utf-8") for r in resourceIDList]
attrsGroup['projectEndDate'] = str(p.end_date) attrsGroup['projectEndDate'] = str(p.end_date).encode("utf-8")
attrsGroup['lastModifiedTime'] = str(p.modified) attrsGroup['lastModifiedTime'] = str(p.modified).encode("utf-8")
if p.directory_name: if p.directory_name:
attrsGroup['cn'] = str((p.directory_name).encode('utf-8')) attrsGroup['cn'] = p.directory_name.encode('utf-8')
try: try:
result_data = self.searchProject(gidNumber, attrsGroup['cn']) result_data = self.searchProject(gidNumber, str(attrsGroup['cn']))
self.logger.info("attrsGroup 1-- %s ", str(attrsGroup)) self.logger.info("attrsGroup 1-- %s ", str(attrsGroup))
self.logger.info("result_data 1-- %s ", str(result_data)) self.logger.info("result_data 1-- %s ", str(result_data))
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment