source: WAeUP_SRP/trunk/skins/waeup_student/createStudentFT.py @ 1151

Last change on this file since 1151 was 1151, checked in by joachim, 18 years ago

ask for email and password

  • Property svn:keywords set to Id
File size: 1.7 KB
Line 
1## Script (Python) "deleteAllCourses"
2##bind container=container
3##bind context=context
4##bind namespace=
5##bind script=script
6##bind subpath=traverse_subpath
7##parameters=matric_no=None
8##title=
9##
10# $Id: createStudentFT.py 1151 2006-12-29 22:05:53Z joachim $
11''' create the Studenbase folder'''
12
13
14pm = context.portal_membership
15member = pm.getAuthenticatedMember()
16wftool = context.portal_workflow
17students_folder = context.portal_url.getPortalObject().campus.students
18import logging
19logger = logging.getLogger('createStudentFT')
20
21if str(member) not in ("henrik","joachim"):
22    return "not possible"
23if not matric_no:
24    return "No matric_no"
25
26if context.students_catalog(matric_no=matric_no):
27    return "Student with %s already exists" % matric_no
28res = context.returning_import(matric_no = matric_no)
29if len(res) != 1:
30    return "Matricel No %s not found in Returning Table" % matric_no
31student_brain = res[0]
32sid = context.waeup_tool.generateStudentId(student_brain.Lastname[0])
33students_folder.invokeFactory('Student', sid)
34logger.info('"%s","Created Student","%s", "%s" ' % (member,sid,matric_no))
35student = getattr(students_folder,sid)
36wftool.doActionFor(student,'clear_and_validate')
37student.manage_setLocalRoles(sid, ['Owner',])
38context.students_catalog.addRecord(id = sid,
39                                   matric_no = matric_no,
40                                   jamb_reg_no = student_brain.Entryregno,
41                                   sex = student_brain.Sex == "F",
42                                   name = "%s %s %s" % (student_brain.Firstname,
43                                                        student_brain.Middlename,
44                                                        student_brain.Lastname)
45                                )
46return "Student MatricelNo %s and %s created" % (matric_no,sid)
47   
Note: See TracBrowser for help on using the repository browser.