source: WAeUP_SRP/trunk/skins/waeup_student/getStudentId.py @ 1071

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
RevLine 
[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"""
12return StudentId from request
13"""
[1071]14
[1025]15ptl = context.REQUEST.get('PATH_TRANSLATED').split('/')
[1067]16try:
17    id_index = ptl.index('students')
18except:
19    return None
[1071]20if len(ptl) <= id_index + 1:
21    return None
22student_id = ptl[id_index +1]
23if len(student_id) != 7:
24    return None
25try:
26    int(student_id[1:])
27    return student_id
28except:
29    return None
Note: See TracBrowser for help on using the repository browser.