Last change
on this file since 6688 was
5200,
checked in by Henrik Bettermann, 14 years ago
|
add metadata (not indexes!) date_of_birth and marit_stat to students_catalog
fillMetadata.py: tool to fill metadata and/or reindex the students_catalog
|
-
Property svn:keywords set to
Id
|
File size:
978 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 5200 2010-05-20 10:08:17Z 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() |
---|
[5200] | 28 | #elif f == "date_of_birth": |
---|
| 29 | # d[f] = str(d[f]) |
---|
[4001] | 30 | |
---|
| 31 | if not d['email']: |
---|
| 32 | students_object = context.portal_url.getPortalObject().campus.students |
---|
| 33 | student = getattr(students_object, brain.id) |
---|
[4033] | 34 | try: |
---|
| 35 | app_obj = student.application.getContent() |
---|
| 36 | d['email'] = getattr(app_obj, 'app_email', '') |
---|
| 37 | except: |
---|
| 38 | d['email'] = 'not accessible' |
---|
[1269] | 39 | return d |
---|
Note: See
TracBrowser for help on using the repository browser.