Last change
on this file since 2440 was
2439,
checked in by joachim, 17 years ago
|
new versions for getLevel
|
-
Property svn:keywords set to
Id
|
File size:
669 bytes
|
Rev | Line | |
---|
[2439] | 1 | ## Script (Python) "getLevelSession" |
---|
| 2 | ##bind container=container |
---|
| 3 | ##bind context=context |
---|
| 4 | ##bind namespace= |
---|
| 5 | ##bind script=script |
---|
| 6 | ##bind subpath=traverse_subpath |
---|
| 7 | ##parameters=level_doc,student_id,level_id |
---|
| 8 | ##title= |
---|
| 9 | ## |
---|
| 10 | # $Id: getLevelSession.py 2439 2007-10-26 14:48:39Z joachim $ |
---|
| 11 | """ |
---|
| 12 | return fixed session_id from level |
---|
| 13 | """ |
---|
| 14 | session_id = level_doc.session |
---|
| 15 | changed = False |
---|
| 16 | if len(session_id) == 2: |
---|
| 17 | pass |
---|
| 18 | elif len(session_id) == 9: |
---|
| 19 | changed = True |
---|
| 20 | session_id = session_id[2:4] |
---|
| 21 | if len(session_id) != 2: |
---|
| 22 | logger.info("invalid session %s in level %s for student %s" % |
---|
| 23 | (session_id,level_id,student_id)) |
---|
| 24 | else: |
---|
| 25 | if changed: |
---|
| 26 | level_doc.edit(mapping={'session': session_id}) |
---|
| 27 | return session_id |
---|
| 28 | |
---|
| 29 | |
---|
| 30 | |
---|
Note: See
TracBrowser for help on using the repository browser.