Last change
on this file since 5654 was
1514,
checked in by Henrik Bettermann, 18 years ago
|
make work on Windows
|
-
Property svn:keywords set to
Id
|
File size:
451 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 1514 2007-03-02 23:26:27Z henrik $ |
---|
| 11 | """ |
---|
| 12 | return StudentId from request |
---|
| 13 | """ |
---|
[1071] | 14 | |
---|
[1514] | 15 | ptls = context.REQUEST.get('PATH_INFO') |
---|
[1075] | 16 | start = ptls.find('/students/') |
---|
| 17 | if start < -1: |
---|
| 18 | return None |
---|
| 19 | start += 10 |
---|
| 20 | student_id = ptls[start:start+7] |
---|
| 21 | try: |
---|
| 22 | int(student_id[1:]) |
---|
| 23 | return student_id |
---|
| 24 | except: |
---|
| 25 | return None |
---|
| 26 | |
---|
Note: See
TracBrowser for help on using the repository browser.