def set_password(self, raw_password): """Sets the password for the current user :param raw_password: The raw password which will be hashed and stored """ self.crypted_password = make_password(raw_password)
def csv_import(cls, reader): for row in csv.DictReader(reader): crypted_password = make_password(row['password']) school = School.key_for_sis_id(row['school_id']) student = cls.query(cls.sis_id == row['sis_id'], ancestor=school).get() if student is None: student = cls( parent=school, first_name=row['first_name'], last_name=row['last_name'], sis_id=row['sis_id'], grade_level=int(row['grade_level']), email=row['email'], crypted_password=crypted_password ) student.put() logging.info("inserted student: %s" % row) else: # cannot change student from one school to another? student.first_name = row['first_name'] student.last_name = row['last_name'] student.sis_id = row['sis_id'] student.grade_level = int(row['grade_level']) student.email = row['email'] student.crypted_password = crypted_password student.put() logging.info("updated student: %s" % row)
def csv_import(cls, reader): for row in csv.DictReader(reader): crypted_password = make_password(row['password']) school = School.key_for_sis_id(row['school_id']) student = cls.query(cls.sis_id == row['sis_id'], ancestor=school).get() if student is None: student = cls(parent=school, first_name=row['first_name'], last_name=row['last_name'], sis_id=row['sis_id'], grade_level=int(row['grade_level']), email=row['email'], crypted_password=crypted_password) student.put() logging.info("inserted student: %s" % row) else: # cannot change student from one school to another? student.first_name = row['first_name'] student.last_name = row['last_name'] student.sis_id = row['sis_id'] student.grade_level = int(row['grade_level']) student.email = row['email'] student.crypted_password = crypted_password student.put() logging.info("updated student: %s" % row)