## Script (Python) "deleteAllCourses" ##bind container=container ##bind context=context ##bind namespace= ##bind script=script ##bind subpath=traverse_subpath ##parameters=matric_no=None ##title= ## # $Id: createStudentFT.py 1158 2006-12-30 16:58:14Z joachim $ ''' create the Studenbase folder''' pm = context.portal_membership member = pm.getAuthenticatedMember() wftool = context.portal_workflow students_folder = context.portal_url.getPortalObject().campus.students import logging logger = logging.getLogger('createStudentFT') if str(member) not in ("henrik","joachim"): return "not possible" if not matric_no: return "No matric_no" if context.students_catalog(matric_no=matric_no): return "Student with %s already exists" % matric_no res = context.returning_import(matric_no = matric_no) if len(res) != 1: return "Matricel No %s not found in Returning Table" % matric_no student_brain = res[0] sid = context.waeup_tool.generateStudentId(student_brain.Lastname[0]) students_folder.invokeFactory('Student', sid) logger.info('"%s","Created Student","%s", "%s" ' % (member,sid,matric_no)) student = getattr(students_folder,sid) wftool.doActionFor(student,'clear_and_validate') student.manage_setLocalRoles(sid, ['Owner',]) context.students_catalog.addRecord(id = sid, matric_no = matric_no, jamb_reg_no = student_brain.Entryregno, sex = student_brain.Sex == "F", name = "%s %s %s" % (student_brain.Firstname, student_brain.Middlename, student_brain.Lastname) ) return "Student MatricelNo %s and %s Jamb %s created" % (matric_no, sid, student_brain.Entryregno)