[1167] | 1 | ## Script (Python) "getPersonalInfo" |
---|
| 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 | """ |
---|
| 12 | return Info about the current Student |
---|
| 13 | """ |
---|
| 14 | import logging |
---|
[1571] | 15 | logger = logging.getLogger('Skins.getPersonalInfo') |
---|
[1167] | 16 | |
---|
| 17 | request = context.REQUEST |
---|
[3102] | 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('/') |
---|
| 23 | # ##from Products.zdb import set_trace |
---|
| 24 | # ##set_trace() |
---|
| 25 | # if mtool.isAnonymousUser(): |
---|
| 26 | # return None |
---|
| 27 | # info = {} |
---|
| 28 | # requested_id = context.getStudentId() |
---|
| 29 | # if requested_id and not context.isStaff() and member_id != requested_id: |
---|
| 30 | # logger.info('%s tried to access personal 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 | |
---|
| 38 | info = context.waeup_tool.getAccessInfo(context) |
---|
| 39 | student_id = info['student_id'] |
---|
| 40 | if student_id is None: |
---|
[1167] | 41 | return None |
---|
| 42 | |
---|
| 43 | students_object = context.portal_url.getPortalObject().campus.students |
---|
| 44 | student = getattr(students_object, student_id) |
---|
[1203] | 45 | info['student'] = student |
---|
| 46 | info['id'] = student_id |
---|
[1871] | 47 | info['review_state'] = context.getStudentReviewState() |
---|
[1203] | 48 | info['per'] = student.personal |
---|
[1167] | 49 | info['per_doc'] = student.personal.getContent() |
---|
| 50 | return info |
---|