source: WAeUP_SRP/branches/uli/skins/waeup_student/getMemberInfo.py @ 13808

Last change on this file since 13808 was 1593, checked in by uli, 18 years ago

Merged current trunk into uli-branch.

File size: 2.7 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:
[1593]30    logger.info('%s tried to access personal object of %s' % (member_id,requested_id))
[1220]31    student_id = requested_id
[1593]32    return None
[1220]33elif context.isStaff():
34    student_id = requested_id
35else:
36    student_id = member_id
37
38
39students_object = context.portal_url.getPortalObject().campus.students
40student = getattr(students_object, student_id)
[1223]41
[1281]42if hasattr(student,"application"):
[1254]43
[1281]44    info['student'] = student
45    info['id'] = student_id
46    info['review_state'] = wf.getInfoFor(student,'review_state',None)
47    info['per'] = student.personal
48    info['app'] = student.application
49    info['per_doc'] = student.personal.getContent()
50    info['app_doc'] = student.application.getContent()
51    info['clear_doc'] = student.clearance.getContent()
52    info['password'] = context.waeup_tool.getCredential(student_id)
53
54    if info['per_doc'].email:
55        info['email'] = info['per_doc'].email
56    else:
57        info['email'] = info['app_doc'].app_email
58
59    msg="""
[1268]60Your SRP Member Details
61-----------------------
62
[1223]63Fullname: %s
64Student Id: %s
65Matriculation Number: %s
66JAMB Registration Number: %s
[1541]67Registration Status: %s
[1254]68Email Address in Application Data: %s
69Email Address in Personal Data: %s
[1223]70Date of Birth: %s
[1316]71Password: '%s'
[1223]72
73"""
74
[1281]75    info['message'] = msg % (
76        student.Title(),
77        student_id,
78        info['clear_doc'].matric_no,
79        info['app_doc'].jamb_reg_no,
[1541]80        info['review_state'],
[1281]81        info['app_doc'].app_email,
82        info['per_doc'].email,
83        info['clear_doc'].birthday,
84        info['password']
85        )
86else:
[1316]87
[1281]88    info['student'] = student
89    info['id'] = student_id
90    info['review_state'] = wf.getInfoFor(student,'review_state',None)
91    info['password'] = context.waeup_tool.getCredential(student_id)
[1448]92    info['email'] = 'N/A'
[1223]93
[1281]94    msg="""
95Your SRP Member Details
96-----------------------
97
98Fullname: %s
99Student Id: %s
100Password: %s
101
102"""
103
104    info['message'] = msg % (
[1448]105        'N/A',
[1281]106        student_id,
107        info['password']
108        )
109
[1316]110
111
112
113
[1220]114return info
Note: See TracBrowser for help on using the repository browser.