source: WAeUP_SRP/trunk/skins/waeup_student/getFormattedStudentEntry.py @ 5186

Last change on this file since 5186 was 4033, checked in by Henrik Bettermann, 16 years ago

improve security level for lecturers

  • Property svn:keywords set to Id
File size: 912 bytes
Line 
1## Script (Python) "getFormattedStudentEntry"
2##bind container=container
3##bind context=context
4##bind namespace=
5##bind script=script
6##bind subpath=traverse_subpath
7##parameters=brain
8##title=
9##
10# $Id: getFormattedStudentEntry.py 4033 2009-03-30 21:14:56Z henrik $
11"""
12return a formatted StudentCatalog Entry
13"""
14#from Products.zdb import set_trace;set_trace()
15fields = context.students_catalog.schema()
16d = {}
17for f in fields:
18    d[f] = getattr(brain,f,'')
19    if not d[f]:
20        d[f] = ''
21    if f == "sex":
22        if d[f]:
23            d[f] = 'F'
24        else:
25            d[f] = 'M'
26    elif f == "name":
27        d[f] = d[f].strip()
28
29if not d['email']:
30    students_object = context.portal_url.getPortalObject().campus.students
31    student = getattr(students_object, brain.id)
32    try:
33        app_obj = student.application.getContent()
34        d['email'] = getattr(app_obj, 'app_email', '')
35    except:
36        d['email'] = 'not accessible'
37return d           
Note: See TracBrowser for help on using the repository browser.