ignore mal-formed input lines

sort usernames by default
This commit is contained in:
lars 2010-06-05 01:22:20 +00:00
parent ea8a8d8d80
commit f611eac8ad

View file

@ -55,6 +55,7 @@ class HtpasswdFile:
"""
self.entries = {}
for line in open(self.filename, 'r').readlines():
if ":" in line:
username, pwhash = line.split(':', 1)
self.entries[username] = pwhash
@ -96,5 +97,7 @@ class HtpasswdFile:
self.entries.pop(username)
def get_usernames(self):
return self.entries.keys()
names = self.entries.keys()
names.sort()
return names