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

Last change on this file since 647 was 646, checked in by joachim, 19 years ago

fixed getStudentInfo a little bit more

File size: 2.0 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)
25if student is None:
26    if context.isManager:
27        if context.portal_type == 'Student':
28            student_id = context.getId()
29        else:
30            student_id = context.aq_parent.getId()
31    else:
32        student_id = member_id
33else:
34    student_id = student.getId()
35res = context.portal_catalog(portal_type='Student',id=student_id)
36if not res:
37    return None
38brain = res[0]
39student = brain.getObject()
40student_path = brain.getPath()   
41##if student is None:
42##    students = getattr(context,'students',None)
43##    if students is None:
44##        students = getattr(context.campus,'students',None)
45##    student = getattr(students,member_id,None)
46##    if student is None:
47##        return None
48info['review_state'] = wf.getInfoFor(student,'review_state','keiner')
49#info['wf_state'] = 'keiner'
50info['student'] = student
51info['id'] = student.getId()
52info['student_doc'] = student.getContent()
53info['app'] = student.application
54info['app_doc'] = student.application.getContent()
55info['per'] = student.personal
56info['per_doc'] = student.personal.getContent()
57info['sex'] = 'male'
58if info['per_doc'].sex:
59    info['sex'] = 'female'
60res = context.portal_catalog(container_path=student_path,
61                             portal_type='StudentAccommodation')
62if res:
63    acco = res[0].getObject()
64    info['acco'] = acco
65    info['acco_doc'] = acco.getContent()
66else:
67    info['acco'] = None
68return info
Note: See TracBrowser for help on using the repository browser.