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,11 +60,12 @@ class Database: ...@@ -60,11 +60,12 @@ class Database:
self._users = {} self._users = {}
self.filename = filename self.filename = filename
self.load() self.load()
if self.realm and self.realm != realm: if realm:
raise ValueError, ("Specified realm %r differs from " if self.realm and self.realm != realm:
"database realm %r" % (realm or '', self.realm)) raise ValueError, ("Specified realm %r differs from database "
else: "realm %r" % (realm or '', self.realm))
self.realm = realm else:
self.realm = realm
def save(self, fd=None): def save(self, fd=None):
filename = self.filename filename = self.filename
......
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