Last change
on this file since 1042 was
1042,
checked in by joachim, 18 years ago
|
improved isStudent speed
|
-
Property svn:keywords set to
Id
|
File size:
504 bytes
|
Line | |
---|
1 | ## Script (Python) "isStudent" |
---|
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: isStudent.py 1042 2006-12-13 13:35:50Z joachim $ |
---|
11 | |
---|
12 | #session = context.REQUEST.SESSION |
---|
13 | #roles = member.getRolesInContext(context) |
---|
14 | #return "Student" in roles |
---|
15 | |
---|
16 | mtool = context.portal_membership |
---|
17 | member = mtool.getAuthenticatedMember() |
---|
18 | member_id = str(member) |
---|
19 | if len(member_id) == 7: |
---|
20 | try: |
---|
21 | int(member_id[1:]) |
---|
22 | return True |
---|
23 | except: |
---|
24 | return False |
---|
Note: See
TracBrowser for help on using the repository browser.