Last change
on this file since 1071 was
1071,
checked in by joachim, 18 years ago
|
speed improvements for waeup_edit and portlet_session_info
|
-
Property svn:keywords set to
Id
|
File size:
540 bytes
|
Rev | Line | |
---|
[1025] | 1 | ## Script (Python) "getStudentId" |
---|
| 2 | ##bind container=container |
---|
| 3 | ##bind context=context |
---|
| 4 | ##bind namespace= |
---|
| 5 | ##bind script=script |
---|
| 6 | ##bind subpath=traverse_subpath |
---|
| 7 | ##parameters= |
---|
| 8 | ##title= |
---|
| 9 | ## |
---|
| 10 | # $Id: getStudentId.py 1071 2006-12-16 15:53:13Z joachim $ |
---|
| 11 | """ |
---|
| 12 | return StudentId from request |
---|
| 13 | """ |
---|
[1071] | 14 | |
---|
[1025] | 15 | ptl = context.REQUEST.get('PATH_TRANSLATED').split('/') |
---|
[1067] | 16 | try: |
---|
| 17 | id_index = ptl.index('students') |
---|
| 18 | except: |
---|
| 19 | return None |
---|
[1071] | 20 | if len(ptl) <= id_index + 1: |
---|
| 21 | return None |
---|
| 22 | student_id = ptl[id_index +1] |
---|
| 23 | if len(student_id) != 7: |
---|
| 24 | return None |
---|
| 25 | try: |
---|
| 26 | int(student_id[1:]) |
---|
| 27 | return student_id |
---|
| 28 | except: |
---|
| 29 | return None |
---|
Note: See
TracBrowser for help on using the repository browser.