[1161] | 1 | ## Script (Python) "getApplicationInfo" |
---|
[1071] | 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 1435 2007-02-19 10:35:10Z henrik $ |
---|
| 11 | """ |
---|
| 12 | return Info about the current Student |
---|
| 13 | """ |
---|
| 14 | import logging |
---|
[1082] | 15 | logger = logging.getLogger('Student.Application.Info') |
---|
[1071] | 16 | |
---|
| 17 | request = context.REQUEST |
---|
| 18 | mtool = context.portal_membership |
---|
| 19 | wf = context.portal_workflow |
---|
| 20 | member = mtool.getAuthenticatedMember() |
---|
| 21 | member_id = str(member) |
---|
| 22 | path_info = request.get('PATH_INFO').split('/') |
---|
[1078] | 23 | ##from Products.zdb import set_trace |
---|
| 24 | ##set_trace() |
---|
[1071] | 25 | if mtool.isAnonymousUser(): |
---|
| 26 | return None |
---|
| 27 | info = {} |
---|
| 28 | requested_id = context.getStudentId() |
---|
[1090] | 29 | if requested_id and not context.isStaff() and member_id != requested_id: |
---|
[1088] | 30 | logger.info('"%s", "accessed application object of", "%s"' % (member_id,requested_id)) |
---|
[1161] | 31 | student_id = requested_id |
---|
[1090] | 32 | elif context.isStaff(): |
---|
| 33 | student_id = requested_id |
---|
[1088] | 34 | else: |
---|
[1071] | 35 | student_id = member_id |
---|
| 36 | |
---|
| 37 | |
---|
| 38 | students_object = context.portal_url.getPortalObject().campus.students |
---|
| 39 | student = getattr(students_object, student_id) |
---|
| 40 | info['id'] = student_id |
---|
| 41 | info['student'] = student |
---|
| 42 | info['review_state'] = wf.getInfoFor(student,'review_state',None) |
---|
| 43 | info['app'] = student.application |
---|
| 44 | info['app_doc'] = student.application.getContent() |
---|
[1435] | 45 | #info['name'] = context.getStudentName() |
---|
[1071] | 46 | return info |
---|