Commit 51147cc9 authored by Christian Robottom's avatar Christian Robottom

Rework overzealous check when specifying realm to Database.

parent 790480c9
...@@ -46,7 +46,7 @@ class Database: ...@@ -46,7 +46,7 @@ class Database:
usernames to password hashes. The hashes are SHA hex digests usernames to password hashes. The hashes are SHA hex digests
produced from the password string. produced from the password string.
""" """
realm = None
def __init__(self, filename, realm=None): def __init__(self, filename, realm=None):
"""Creates a new Database """Creates a new Database
...@@ -60,9 +60,10 @@ class Database: ...@@ -60,9 +60,10 @@ class Database:
self._users = {} self._users = {}
self.filename = filename self.filename = filename
self.load() self.load()
if realm:
if self.realm and self.realm != realm: if self.realm and self.realm != realm:
raise ValueError, ("Specified realm %r differs from " raise ValueError, ("Specified realm %r differs from database "
"database realm %r" % (realm or '', self.realm)) "realm %r" % (realm or '', self.realm))
else: else:
self.realm = realm self.realm = realm
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment