def __init__(self, databaseFile, name=None): Observable.__init__(self, name=name) self._apiKeys = {} self._filename = databaseFile if not isfile(self._filename): self._makePersistent() else: self._apiKeys = jsonRead(open(self._filename)) self._actions = { 'create': self.handleCreate, 'update': self.handleUpdate }
def __init__(self, filename, hashPassword, passwordTest=simplePasswordTest, usernameTest=usernameTest): self._hashPassword = hashPassword self._passwordTest = passwordTest self._usernameTest = usernameTest self._filename = filename self._users = {} if not isfile(filename): self._users['admin'] = self._hashPassword('admin') self._makePersistent() else: self._users = jsonRead(open(filename))