Changeset 1170 for WAeUP_SRP/trunk/skins
- Timestamp:
- 1 Jan 2007, 18:08:45 (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
WAeUP_SRP/trunk/skins/waeup_student/createReturningStudent.py
r1169 r1170 21 21 #if str(member) not in ("admin","joachim"): 22 22 # return "not possible" 23 def createOne(student_brain): 24 sid = context.waeup_tool.generateStudentId('?') 25 students_folder.invokeFactory('Student', sid) 26 student = getattr(students_folder,sid) 27 wftool.doActionFor(student,'return') 28 student.manage_setLocalRoles(sid, ['Owner',]) 29 jamb_reg_no = student_brain.Entryregno, 30 context.students_catalog.addRecord(id = sid, 31 matric_no = matric_no, 32 jamb_reg_no = jamb_reg_no, 33 sex = student_brain.Sex == "F", 34 name = "%s %s %s" % (student_brain.Firstname, 35 student_brain.Middlename, 36 student_brain.Lastname) 37 ) 38 return sid,jamb_reg_no 39 23 40 if not matric_no: 24 41 return "No MatricNo" 25 42 26 if context.students_catalog(matric_no=matric_no): 27 return "Student with %s already exists" % matric_no 28 res = context.returning_import(matric_no = matric_no) 29 if len(res) != 1: 30 return "MatricNo %s not found in Returning Table" % matric_no 31 student_brain = res[0] 32 sid = context.waeup_tool.generateStudentId('?') 33 students_folder.invokeFactory('Student', sid) 34 logger.info('"%s","Created Student","%s", "%s" ' % (member,sid,matric_no)) 35 student = getattr(students_folder,sid) 36 wftool.doActionFor(student,'return') 37 student.manage_setLocalRoles(sid, ['Owner',]) 38 jamb_reg_no = student_brain.Entryregno, 39 context.students_catalog.addRecord(id = sid, 40 matric_no = matric_no, 41 jamb_reg_no = jamb_reg_no, 42 sex = student_brain.Sex == "F", 43 name = "%s %s %s" % (student_brain.Firstname, 44 student_brain.Middlename, 45 student_brain.Lastname) 46 ) 47 return "Student MatricNo %s, StudentId %s Jamb %s created" % (matric_no,sid,jamb_reg_no) 43 if matric_no != 'All': 44 if context.students_catalog(matric_no=matric_no): 45 return "Student with %s already exists" % matric_no 46 res = context.returning_import(matric_no = matric_no) 47 if len(res) != 1: 48 return "MatricNo %s not found in Returning Table" % matric_no 49 student_brain = res[0] 50 #sid,jamb_reg_no = context.waeup_tool.createOne(student_brain) 51 sid,jamb_reg_no = context.createOne(student_brain) 52 logger.info('"%s","Created Student","%s", "%s" ' % (member,sid,matric_no)) 53 return "Student MatricNo %s, StudentId %s Jamb %s created" % (matric_no,sid,jamb_reg_no) 48 54 55 students = context.returning_import(emil="adf") 56 count = 1 57 total = 0 58 logger.info('"%s","Create Students start"' % (member)) 59 #from Products.zdb import set_trace;set_trace() 60 for student in students: 61 if context.students_catalog(matric_no=student.matric_no): 62 logger.info('"Student already exists","%s"' % (student.matric_no)) 63 continue 64 if count > 100: 65 context.waeup_tool.createOne(student,commit=True) 66 logger.info('"%s","Commited Students","%s", "%s" ' % (member,count,total)) 67 total += count 68 count = 1 69 else: 70 context.waeup_tool.createOne(student) 71 count += 1 72 logger.info('"%s","Create Students finish","%s"' % (member,total))
Note: See TracChangeset for help on using the changeset viewer.