Skip to content

Commit

Permalink
Fix bytes issues in readUserAccessFile function.
Browse files Browse the repository at this point in the history
This is used to read e.g. `inituser` at Zope startup.
  • Loading branch information
hannosch committed May 15, 2017
1 parent 05c5fe8 commit 9a9c57f
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions src/AccessControl/users.py
Expand Up @@ -367,20 +367,20 @@ def readUserAccessFile(filename):
return None

try:
f = open(os.path.join(instancehome, filename), 'r')
line = f.readline()
f.close()
with open(os.path.join(instancehome, filename), 'rb') as f:
line = f.readline()
except IOError:
return None

if line:
data = line.strip().split(':')
data = line.strip().split(b':')
user = data[0].decode('utf-8')
remote_user_mode = not data[1]
try:
ds = data[2].split(' ')
except:
ds = data[2].split(b' ')
except IndexError:
ds = []
return data[0], data[1], ds, remote_user_mode
return (user, data[1], ds, remote_user_mode)
else:
return None

Expand Down

0 comments on commit 9a9c57f

Please sign in to comment.