source: WAeUP_SRP/trunk/skins/waeup_student/getMemberInfo.py @ 1264

Last change on this file since 1264 was 1254, checked in by Henrik Bettermann, 18 years ago

mail_password_form now available

File size: 2.0 KB
RevLine 
[1220]1## Script (Python) "getMemberInfo"
2##bind container=container
3##bind context=context
4##bind namespace=
5##bind script=script
6##bind subpath=traverse_subpath
7##parameters=
8##title=
9##
10# $Id: getApplicationInfo.py 1161 2006-12-31 07:50:50Z henrik $
11"""
12return Info about the current Student
13"""
14import logging
15logger = logging.getLogger('Student.Member.Info')
16
17request = context.REQUEST
18mtool = context.portal_membership
19wf = context.portal_workflow
20member = mtool.getAuthenticatedMember()
21member_id = str(member)
22path_info = request.get('PATH_INFO').split('/')
23##from Products.zdb import set_trace
24##set_trace()
25if mtool.isAnonymousUser():
26    return None
27info = {}
28requested_id = context.getStudentId()
29if requested_id and not context.isStaff() and member_id != requested_id:
30    logger.info('"%s", "accessed personal object of", "%s"' % (member_id,requested_id))
31    student_id = requested_id
32elif context.isStaff():
33    student_id = requested_id
34else:
35    student_id = member_id
36
37
38students_object = context.portal_url.getPortalObject().campus.students
39student = getattr(students_object, student_id)
40info['student'] = student
41info['id'] = student_id
42info['review_state'] = wf.getInfoFor(student,'review_state',None)
43info['per'] = student.personal
44info['app'] = student.application
45info['per_doc'] = student.personal.getContent()
[1223]46info['app_doc'] = student.application.getContent()
47info['clear_doc'] = student.clearance.getContent()
[1254]48info['password'] = context.waeup_tool.getCredential(student_id)
[1223]49
[1254]50if info['per_doc'].email:
51    info['email'] = info['per_doc'].email
52else:
53    info['email'] = info['app_doc'].app_email
54
[1223]55msg="""
56Fullname: %s
57Student Id: %s
58Matriculation Number: %s
59JAMB Registration Number: %s
[1254]60Email Address in Application Data: %s
61Email Address in Personal Data: %s
[1223]62Date of Birth: %s
[1254]63Password: %s
[1223]64
65"""
66
67info['message'] = msg % (
68    student.Title(),
69    student_id,
70    info['clear_doc'].matric_no,
71    info['app_doc'].jamb_reg_no,
72    info['app_doc'].app_email,
73    info['per_doc'].email,
74    info['clear_doc'].birthday,
[1254]75    info['password']
[1223]76    )
77
[1220]78return info
Note: See TracBrowser for help on using the repository browser.