Last change
on this file since 1736 was
1415,
checked in by joachim, 18 years ago
|
added new Function add_student
|
-
Property svn:keywords set to
Id
|
File size:
567 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 1415 2007-02-14 12:54:55Z joachim $ |
---|
| 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,'') |
---|
[1269] | 19 | if f == "sex": |
---|
| 20 | if d[f]: |
---|
[1315] | 21 | d[f] = 'F' |
---|
| 22 | else: |
---|
| 23 | d[f] = 'M' |
---|
[1314] | 24 | elif f == "name": |
---|
| 25 | d[f] = d[f].strip() |
---|
[1269] | 26 | return d |
---|
Note: See
TracBrowser for help on using the repository browser.