1 | ## Script (Python) "getApplicationInfo" |
---|
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 2975 2008-01-03 17:20:02Z joachim $ |
---|
11 | """ |
---|
12 | return Info about the current Student |
---|
13 | """ |
---|
14 | |
---|
15 | request = context.REQUEST |
---|
16 | # mtool = context.portal_membership |
---|
17 | # wf = context.portal_workflow |
---|
18 | # member = mtool.getAuthenticatedMember() |
---|
19 | # member_id = str(member) |
---|
20 | # path_info = request.get('PATH_INFO').split('/') |
---|
21 | # ##from Products.zdb import set_trace |
---|
22 | # ##set_trace() |
---|
23 | # if mtool.isAnonymousUser(): |
---|
24 | # return None |
---|
25 | # info = {} |
---|
26 | # requested_id = context.getStudentId() |
---|
27 | # if requested_id and not context.isStaff() and member_id != requested_id: |
---|
28 | # import logging |
---|
29 | # logger = logging.getLogger('Skins.getApplicationInfo') |
---|
30 | # logger.info('%s tried to access application object of %s' % (member_id,requested_id)) |
---|
31 | # student_id = requested_id |
---|
32 | # return None |
---|
33 | # elif context.isStaff(): |
---|
34 | # student_id = requested_id |
---|
35 | # else: |
---|
36 | # student_id = member_id |
---|
37 | info = context.waeup_tool.getAccessInfo(context) |
---|
38 | student_id = info['student_id'] |
---|
39 | if student_id is None: |
---|
40 | return None |
---|
41 | |
---|
42 | info['has_passport'] = context.waeup_tool.picturesExist(('passport',), student_id) |
---|
43 | |
---|
44 | students_object = context.portal_url.getPortalObject().campus.students |
---|
45 | student = getattr(students_object, student_id) |
---|
46 | info['id'] = student_id |
---|
47 | info['student'] = student |
---|
48 | info['review_state'] = context.getStudentReviewState() |
---|
49 | info['app'] = student.application |
---|
50 | info['app_doc'] = student.application.getContent() |
---|
51 | #info['name'] = context.getStudentName() |
---|
52 | return info |
---|