## Script (Python) "getFormattedStudentEntry" ##bind container=container ##bind context=context ##bind namespace= ##bind script=script ##bind subpath=traverse_subpath ##parameters=brain ##title= ## # $Id: getFormattedStudentEntry.py 4001 2009-03-06 17:39:17Z henrik $ """ return a formatted StudentCatalog Entry """ #from Products.zdb import set_trace;set_trace() fields = context.students_catalog.schema() d = {} for f in fields: d[f] = getattr(brain,f,'') if not d[f]: d[f] = '' if f == "sex": if d[f]: d[f] = 'F' else: d[f] = 'M' elif f == "name": d[f] = d[f].strip() if not d['email']: students_object = context.portal_url.getPortalObject().campus.students student = getattr(students_object, brain.id) app_obj = student.application.getContent() d['email'] = getattr(app_obj, 'app_email', '') return d