Last change
on this file since 1061 was
1042,
checked in by joachim, 18 years ago
|
improved isStudent speed
|
-
Property svn:keywords set to
Id
|
File size:
504 bytes
|
Rev | Line | |
---|
[845] | 1 | ## Script (Python) "isStudent" |
---|
[600] | 2 | ##bind container=container |
---|
| 3 | ##bind context=context |
---|
| 4 | ##bind namespace= |
---|
| 5 | ##bind script=script |
---|
| 6 | ##bind subpath=traverse_subpath |
---|
[874] | 7 | ##parameters= |
---|
[600] | 8 | ##title= |
---|
| 9 | ## |
---|
[805] | 10 | # $Id: isStudent.py 1042 2006-12-13 13:35:50Z joachim $ |
---|
[885] | 11 | |
---|
[1042] | 12 | #session = context.REQUEST.SESSION |
---|
| 13 | #roles = member.getRolesInContext(context) |
---|
| 14 | #return "Student" in roles |
---|
| 15 | |
---|
[885] | 16 | mtool = context.portal_membership |
---|
[1042] | 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.