Changeset 1957


Ignore:
Timestamp:
25 Jun 2007, 18:45:38 (18 years ago)
Author:
joachim
Message:

replace calls to isStudent by inline statements, please test.

Location:
WAeUP_SRP/trunk
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • WAeUP_SRP/trunk/PatchCPSUserFolderUserFolder.py

    r1612 r1957  
    33from Acquisition import Implicit
    44from Acquisition import aq_base, aq_parent, aq_inner
    5 
     5import re
    66security = ClassSecurityInfo()
    77
     
    7070            roles.append(r)
    7171    ## patch to assign dynamic roles for WAeUP
    72     while 1:
    73         if self.isStudent():
     72    while 1:       
     73        #if self.isStudent():
     74        #    break
     75        # if re.match(r'\D\d\d\d\d\d\d',name):
     76        #    break
     77        #if len(name) != 7:
     78        #    break
     79        #try:
     80        #    int(name[1:])
     81        #except:
     82        #    break
     83        for c in name:
     84            is_student = True
     85            if c not in ('0123456789'):
     86                is_student = False
     87        if is_student and len(name) == 7:
    7488            break
    7589        groups = self.portal_membership.getAuthenticatedMember().getGroups()
  • WAeUP_SRP/trunk/skins/waeup_default/isCourseAdviser.py

    r1581 r1957  
    99##
    1010# $Id: isClearanceOfficer.py 1087 2006-12-18 22:13:31Z joachim $
    11 if context.isStudent():
     11member = context.portal_membership.getAuthenticatedMember()
     12member_id = str(member)
     13for c in member_id:
     14    is_student = True
     15    if c not in ('0123456789'):
     16        is_student = False
     17        break
     18if is_student and len(member_id) == 7:
    1219    return False
    13 mtool = context.portal_membership
    14 roles = mtool.getAuthenticatedMember().getRolesInContext(context)
     20# if context.isStudent():
     21#     return False
     22roles = member.getRolesInContext(context)
    1523return "CourseAdviser" in roles
    1624
  • WAeUP_SRP/trunk/skins/waeup_default/isSectionOfficer.py

    r1077 r1957  
    1010# $Id: isManager.py 888 2006-11-17 21:28:48Z henrik $
    1111
    12 if context.isStudent():
     12member = context.portal_membership.getAuthenticatedMember()
     13member_id = str(member)
     14for c in member_id:
     15    is_student = True
     16    if c not in ('0123456789'):
     17        is_student = False
     18        break
     19if is_student and len(member_id) == 7:
    1320    return False
    14 mtool = context.portal_membership
    15 roles = mtool.getAuthenticatedMember().getRolesInContext(context)
     21# if context.isStudent():
     22#     return False
     23roles = member.getRolesInContext(context)
    1624return "SectionOfficer" in roles or\
    1725       "SectionManager" in roles or\
  • WAeUP_SRP/trunk/skins/waeup_default/isStaff.py

    r1737 r1957  
    1010# $Id: $
    1111
    12 if context.portal_membership.isAnonymousUser():
    13     return False
    14 return not context.isStudent()
     12# if context.portal_membership.isAnonymousUser():
     13#     return False
     14# return not context.isStudent()
    1515
    1616mtool = context.portal_membership
    1717member = mtool.getAuthenticatedMember()
    18 roles = member.getRolesInContext(context)
    19 
    20 return "Manager" in roles or\
    21        "SectionManager" in roles or\
    22        "SectionOfficer" in roles or\
    23        "ClearanceOfficer" in roles or\
    24        "CourseAdviser" in roles or\
    25        "CourseAdvisers" in member.getGroups() or\
    26        "ClearanceOfficers" in member.getGroups()
     18member_id = str(member)
     19for c in member_id:
     20    is_student = True
     21    if c not in ('0123456789'):
     22        is_student = False
     23        break
     24return not (is_student and len(member_id) == 7)
  • WAeUP_SRP/trunk/skins/waeup_default/isStudent.py

    r1077 r1957  
    1111
    1212member_id = str(context.portal_membership.getAuthenticatedMember())
    13 if len(member_id) != 7:
    14     return False
    15 try:
    16     int(member_id[1:])
    17     return True
    18 except:
    19     return False
     13#from Products.zdb import set_trace;set_trace()
     14# if len(member_id) != 7:
     15#     return False
     16# try:
     17#     int(member_id[1:])
     18#     return True
     19# except:
     20#     return False
     21for c in member_id:
     22    is_student = True
     23    if c not in ('0123456789'):
     24        is_student = False
     25        break
     26return is_student and len(member_id) == 7
Note: See TracChangeset for help on using the changeset viewer.