Last change
on this file since 2454 was
2451,
checked in by joachim, 17 years ago
|
new getNextInfo used in pay_by_sc
|
-
Property svn:keywords set to
Id
|
File size:
736 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 2451 2007-10-27 14:26:41Z joachim $ |
---|
| 11 | """ |
---|
| 12 | return fixed session_id from level |
---|
| 13 | """ |
---|
[2451] | 14 | import logging |
---|
| 15 | logger = logging.getLogger('Skins.getLevelSession') |
---|
[2439] | 16 | session_id = level_doc.session |
---|
| 17 | changed = False |
---|
| 18 | if len(session_id) == 2: |
---|
| 19 | pass |
---|
| 20 | elif len(session_id) == 9: |
---|
| 21 | changed = True |
---|
| 22 | session_id = session_id[2:4] |
---|
| 23 | if len(session_id) != 2: |
---|
| 24 | logger.info("invalid session %s in level %s for student %s" % |
---|
| 25 | (session_id,level_id,student_id)) |
---|
| 26 | else: |
---|
| 27 | if changed: |
---|
| 28 | level_doc.edit(mapping={'session': session_id}) |
---|
| 29 | return session_id |
---|
| 30 | |
---|
| 31 | |
---|
| 32 | |
---|
Note: See
TracBrowser for help on using the repository browser.