def create_teacher(self, teacher_name, teacher_salary, class_name, class_obj): ''' 创建讲师 ''' teacher_obj = Teacher(teacher_name, teacher_salary) teacher_obj.teacher_add_class(class_name, class_obj) self.school_teacher[teacher_name] = teacher_obj
def signup(self): logging.info("Request Handler: Signing up...") email = self.request_data["login"]["email"] password = self.request_data["login"]["password"] is_user_valid = Helper.is_user_data_valid(email, password) if "Success" in is_user_valid: if Helper.is_teacher_email(email): user = Teacher(email, Helper.hash_password(password)) else: user = Student(email, Helper.hash_password(password)) id = str(ConfirmationManager.get_instance().new_confirmation(user).id) send_email(receivers=email, subject="APHEL TECH EMAIL CONFIRMATION", body=r"url: http://{server_ip}/confirmation_confirmed?id={id}".format( server_ip=config.public_address, id=id)) self.database.store_user(user) logging.info(is_user_valid) return jsonify(data=True, status=is_user_valid) logging.info(is_user_valid) return jsonify(data=False, status=is_user_valid)
def create_teacher(self, teacher_name, teacher_salary, grade_name, grade_obj): teacher_obj = Teacher(teacher_name, teacher_salary) teacher_obj.teacher_add_grade(grade_name, grade_obj) self.school_teacher[teacher_name] = teacher_obj
def add_teacher(self, name, salary): teacher_obj = Teacher(name, salary) print("老师%s 信息录入成功。" % teacher_obj.name) self.teacher.append(teacher_obj)
def create_teacher(self, teacher_name, teacher_salary, skills, classes_name, school_name): # 创建老师 teacher_obj = Teacher(teacher_name, teacher_salary, skills, school_name) classes_obj = self.classes[classes_name] teacher_obj.add_classes(classes_name, classes_obj) # 将课程关联到老师 self.teacher[teacher_name] = teacher_obj
def create_test_data(): schooldata = shelve.open(SCHOOL_DATADIR + "school.db",writeback = True) newschool1 = School("清华","北京") newschool2 = School("武大","武汉") newschool3 = School("川大","四川") newcourse1 = Course("java全站开发","5个月","20000元") newcourse2 = Course("python自动化运维","4个月","30000元") newcourse3 = Course("大数据","5个月","50000元") newteacher1 = Teacher("讲师马云A","123456","男","30","20000","13211114444") newteacher2 = Teacher("讲师马云B","123456","男","30","20000","13211114444") newteacher3 = Teacher("讲师马云C","123456","男","30","20000","13211114444") newteacher4 = Teacher("讲师马云D","123456","男","30","20000","13211114444") newteacher5 = Teacher("讲师马云E","123456","男","30","20000","13211114444") newgrade1 = Grade("1班","讲师马云A","java全站开发") newgrade2 = Grade("2班","讲师马云B","python自动化运维") newgrade3 = Grade("3班","讲师马云C","大数据") newstudent1 = Student("周杰伦1","123456","男","22","False") newstudent2 = Student("周杰伦2","123456","男","22","False") newstudent3 = Student("周杰伦3","123456","男","22","False") newstudent4 = Student("周杰伦4","123456","男","22","False") newstudent5 = Student("周杰伦5","123456","男","22","False") newstudent6 = Student("周杰伦6","123456","男","22","False") newstudent7 = Student("周杰伦7","123456","男","22","False") newstudent8 = Student("周杰伦8","123456","男","22","False") newstudent9 = Student("周杰伦9","123456","男","22","False") newgrade1.grade_student["周杰伦1"] = newstudent1 newgrade1.grade_student["周杰伦2"] = newstudent2 newgrade1.grade_student["周杰伦3"] = newstudent3 newgrade1.grade_student["周杰伦4"] = newstudent4 newgrade1.grade_student["周杰伦5"] = newstudent5 newgrade1.grade_student["周杰伦6"] = newstudent6 newgrade1.grade_student["周杰伦7"] = newstudent7 newgrade1.grade_student["周杰伦8"] = newstudent8 newgrade1.grade_student["周杰伦9"] = newstudent9 newschool1.school_course["java全站开发"] = newcourse1 newschool1.school_course["python自动化运维"] = newcourse2 newschool1.school_course["大数据"] = newcourse3 newschool1.school_grade["1班"] = newgrade1 newschool1.school_grade["2班"] = newgrade2 newschool1.school_grade["3班"] = newgrade3 newschool1.school_teacher["讲师马云A"] = newteacher1 newschool1.school_teacher["讲师马云B"] = newteacher2 newschool1.school_teacher["讲师马云C"] = newteacher3 newschool1.school_teacher["讲师马云D"] = newteacher4 newschool1.school_teacher["讲师马云E"] = newteacher5 schooldata["清华"] = newschool1 schooldata["武大"] = newschool2 schooldata["川大"] = newschool3 schooldata.close()
def createTeacher(self, teacherName, teachClass): teacherObj = Teacher(teacherName) teacherObj.teacherAddClass(teachClass.className, teachClass) #给老师分班级 self.schoolTeacher[teacherName] = teacherObj