def check_pwd(self, aid): from germ.erm.helper import sql_query rset = sql_query("SELECT %s FROM %s WHERE username = '******'" % \ (cf.pwd_str, self.__user_table, self._attr_map['username'].sql_str()), self._session, self._globals) if len(rset) > 1: # TODO: Make this an invalid_key exception. This could very well # occur by a user 'mistake'. On the other hand, can it still occur # if ref_group.generate_keylist did not complain? from germ.error.error import error raise error(error.fail, "Ambiguous primary key: result has " + \ "multiple records", "number of records: %s" % \ len(rset)) if len(rset) == 0: invalid_auth = True else: passwd = rset[0][0] invalid_auth = not self._attr_map[aid].check(passwd) if invalid_auth: from germ.error.invalid_parm import invalid_parm raise invalid_parm('Wrong username/password')
def set_default(self): from germ.error.invalid_parm import invalid_parm found_invalid_parm = False for attr in self._attr_map.itervalues(): if not attr.is_set(): try: attr.set_default() except invalid_parm: found_invalid_parm = True if found_invalid_parm: raise invalid_parm()
def _error(self, e): self.__error_vec.append(e) from germ.error.invalid_parm import invalid_parm raise invalid_parm()