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

Last change on this file since 4006 was 4001, checked in by Henrik Bettermann, 16 years ago
  • fetch email from application object if catalog entry is empty (resolve AAUE #15)
  • fix slip template
  • Property svn:keywords set to Id
File size: 858 bytes
RevLine 
[1269]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 4001 2009-03-06 17:39:17Z 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:
[1415]18    d[f] = getattr(brain,f,'')
[1970]19    if not d[f]:
20        d[f] = ''
[1269]21    if f == "sex":
22        if d[f]:
[1315]23            d[f] = 'F'
24        else:
25            d[f] = 'M'
[1314]26    elif f == "name":
27        d[f] = d[f].strip()
[4001]28
29if not d['email']:
30    students_object = context.portal_url.getPortalObject().campus.students
31    student = getattr(students_object, brain.id)
32    app_obj = student.application.getContent()
33    d['email'] = getattr(app_obj, 'app_email', '')
[1970]34           
[1269]35return d           
Note: See TracBrowser for help on using the repository browser.