Changeset 1576 for WAeUP_SRP


Ignore:
Timestamp:
18 Mar 2007, 14:48:06 (18 years ago)
Author:
joachim
Message:

Fix for #121 also improve handling of "Processing in progress"

Location:
WAeUP_SRP/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • WAeUP_SRP/trunk/PatchCPSUserFolderUserFolder.py

    r1569 r1576  
    7171    ## patch to assign dynamic roles for WAeUP
    7272    while 1:
    73         break
    74         if self.isStudent() or self.isSectionOfficer():
     73        #from pdb import set_trace;set_trace()
     74        if self.isStudent():
     75            break
     76        groups = self.portal_membership.getAuthenticatedMember().getGroups()
     77        if not ("ClearanceOfficer" in groups or "CourseAdviser" in groups):
    7578            break
    7679        if callable(real_object) and hasattr(real_object,'im_self'):
     
    8083            break
    8184        if hasattr(real_object,'portal_type') and\
    82                    real_object.portal_type not in ("Student","StudentClearance","StudentStudyLevel"):
     85                   real_object.portal_type not in ("Student",
     86                                                   "StudentClearance",
     87                                                   "StudentStudyLevel"):
    8388            break
    8489
    85         #from pdb import set_trace;set_trace()
    8690        # can be later simplified by replacing by students_catalog values - Henrik
    8791        # getattr works always because of acquisition ?! Henrik
     
    115119                                                )
    116120        if real_object.portal_type == "StudentStudyLevel":
    117             context_obj = getattr(certificate_obj,real_object.getId())
     121            if real_object.meta_type == "StudentStudyLevel":
     122                #if it is not a Proxy
     123                break
     124            context_obj = getattr(certificate_obj,real_object.getId(),None)
     125            if context_obj is None:
     126                break
    118127            allowed = ('CourseAdviser', 'SectionManager')
    119128        else:
  • WAeUP_SRP/trunk/skins/waeup_student/create_level.py

    r1571 r1576  
    3030cert_id = student.course
    3131current_level = student.level
    32 in_progress =  session.get('in_progress','finished')
    33 if in_progress == 'finished':
     32in_progress =  request.get('in_progress','not started')
     33
     34if context.hasObject(current_level):
     35    response.redirect("%s/%s" % (context.absolute_url(),current_level))
     36    return
     37
     38if in_progress in ('not started','started'):
    3439    session.set('in_progress','started')
    35     view = context.in_progress_view(refresh=3,page='%s/study_level_view' % current_level)
     40    view = context.in_progress_view(refresh=3,page='create_level?in_progress=started')
    3641    response.setHeader('Content-type','text/html; charset=ISO-8859-15')
    3742    response.setHeader('Content-length','%d' % (len(view)))
     
    3944    response.write(view)
    4045    response.write('')
    41 elif in_progress == 'started':
    42     return
    43 
    44 if context.hasObject(current_level):
    45     return
    46     level = getattr(context,current_level)
    47     return response.redirect("%s" % level.absolute_url())
     46    if in_progress == 'started':
     47        return
     48   
    4849
    4950context.invokeFactory('StudentStudyLevel',"%s" % current_level)
     
    105106        d['core_or_elective'] = getattr(c.getObject().getContent(),'core_or_elective')
    106107        course_result.getContent().edit(mapping=d)
    107 session.set('in_progress','finished')
    108108return
Note: See TracChangeset for help on using the changeset viewer.