source: WAeUP_SRP/branches/uli/skins/waeup_student/getStudentBaseInfo.py @ 10822

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

Merged current trunk into uli-branch.

File size: 1.3 KB
Line 
1## Script (Python) "getStudentBaseInfo"
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: getTransferInfo.py 1339 2007-01-21 22:55:34Z henrik $
11"""
12return Info about the current Student
13"""
14import logging
15logger = logging.getLogger('Skins.getStudentBaseInfo')
16from DateTime import DateTime
17
18request = context.REQUEST
19mtool = context.portal_membership
20wf = context.portal_workflow
21member = mtool.getAuthenticatedMember()
22member_id = str(member)
23
24if mtool.isAnonymousUser():
25    return None
26info = {}
27#from Products.zdb import set_trace
28#set_trace()
29requested_id = context.getStudentId()
30if requested_id and not context.isStaff() and member_id != requested_id:
31    logger.info('%s tried to access %s' % (member_id,requested_id))
32    return None
33elif context.isStaff():
34    student_id = requested_id
35else:
36    student_id = member_id
37
38
39#students_object = context.portal_url.getPortalObject().campus.students
40#student = getattr(students_object,student_id)
41
42res = context.students_catalog(id = student_id)
43if len(res) != 1:
44    return None
45sbrain = res[0]
46info['id'] = student_id
47info['student'] = context.getFormattedStudentEntry(sbrain)
48#info['entry_mode'] = sbrain.entry_mode
49
50
51return info
Note: See TracBrowser for help on using the repository browser.