Last change
on this file since 4627 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
|
Rev | Line | |
---|
[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 4033 2009-03-30 21:14:56Z henrik $ |
---|
| 11 | """ |
---|
| 12 | return a formatted StudentCatalog Entry |
---|
| 13 | """ |
---|
| 14 | #from Products.zdb import set_trace;set_trace() |
---|
| 15 | fields = context.students_catalog.schema() |
---|
| 16 | d = {} |
---|
| 17 | for 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 | |
---|
| 29 | if not d['email']: |
---|
| 30 | students_object = context.portal_url.getPortalObject().campus.students |
---|
| 31 | student = getattr(students_object, brain.id) |
---|
[4033] | 32 | try: |
---|
| 33 | app_obj = student.application.getContent() |
---|
| 34 | d['email'] = getattr(app_obj, 'app_email', '') |
---|
| 35 | except: |
---|
| 36 | d['email'] = 'not accessible' |
---|
[1269] | 37 | return d |
---|
Note: See
TracBrowser for help on using the repository browser.