source: WAeUP_SRP/trunk/skins/waeup_student/getStudentInfo.py @ 644

Last change on this file since 644 was 639, checked in by joachim, 18 years ago

added

File size: 1.7 KB
Line 
1## Script (Python) "cpsdocument_edit"
2##bind container=container
3##bind context=context
4##bind namespace=
5##bind script=script
6##bind subpath=traverse_subpath
7##parameters=student=None
8##title=
9##
10# $Id: student_edit.py 486 2006-09-06 10:09:39Z joachim $
11"""
12return Info about the current Student
13"""
14request = context.REQUEST
15form = request.form
16fget = form.get
17wf = context.portal_workflow
18mtool = context.portal_membership
19member = mtool.getAuthenticatedMember()
20path_info = request.get('PATH_INFO').split('/')
21roles = member.getRoles()
22info = {}
23info['is_manager'] = context.isManager
24member_id = str(member)
25res = context.portal_catalog(portal_type='Student',id=member_id)
26if not res:
27    return None
28brain = res[0]
29student = brain.getObject()
30student_path = brain.getPath()   
31##if student is None:
32##    students = getattr(context,'students',None)
33##    if students is None:
34##        students = getattr(context.campus,'students',None)
35##    student = getattr(students,member_id,None)
36##    if student is None:
37##        return None
38info['review_state'] = wf.getInfoFor(student,'review_state','keiner')
39#info['wf_state'] = 'keiner'
40info['student'] = student
41info['id'] = student.getId()
42info['student_doc'] = student.getContent()
43info['app'] = student.application
44info['app_doc'] = student.application.getContent()
45info['per'] = student.personal
46info['per_doc'] = student.personal.getContent()
47info['sex'] = 'male'
48if info['per_doc'].sex:
49    info['sex'] = 'female'
50res = context.portal_catalog(container_path=student_path,
51                             portal_type='StudentAccommodation')
52if res:
53    acco = res[0].getObject()
54    info['acco'] = acco
55    info['acco_doc'] = acco.getContent()
56else:
57    info['acco'] = None
58return info
Note: See TracBrowser for help on using the repository browser.