source: WAeUP_SRP/trunk/skins/waeup_student/getPersonalInfo.py @ 1681

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

new logging format Part 4 (rest)

File size: 1.4 KB
RevLine 
[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"""
12return Info about the current Student
13"""
14import logging
[1571]15logger = logging.getLogger('Skins.getPersonalInfo')
[1167]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:
[1571]30    logger.info('%s tried to access personal object of %s' % (member_id,requested_id))
[1167]31    student_id = requested_id
[1571]32    return None
[1167]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)
[1203]41info['student'] = student
[1199]42##res = context.portal_catalog(id = student_id)
43##if res:
44##    info['review_state'] = res[0].review_state
[1203]45info['id'] = student_id
[1199]46info['review_state'] = wf.getInfoFor(student,'review_state',None)
[1203]47info['per'] = student.personal
[1167]48info['per_doc'] = student.personal.getContent()
49return info
Note: See TracBrowser for help on using the repository browser.