Ignore:
Timestamp:
27 Mar 2007, 22:46:46 (18 years ago)
Author:
joachim
Message:

use ceate_course_result

File:
1 edited

Legend:

Unmodified
Added
Removed
  • WAeUP_SRP/trunk/skins/waeup_student/create_level.py

    r1640 r1652  
    3131current_level = student.level
    3232in_progress =  request.get('in_progress','not started')
     33level_created =  request.get('level_created','xxx')
     34create_level =  request.get('create_level',None)
    3335
    34 if context.hasObject(current_level):
     36if context.hasObject(current_level) and create_level :
    3537    logger.info('%s", level %s already exists' % (student.id,current_level))
    36     #response.redirect("%s/%s" % (context.absolute_url(),current_level))
    3738    return
    3839
     
    4849##        return
    4950   
    50 
    51 context.invokeFactory('StudentStudyLevel',"%s" % current_level)
    52 level = getattr(context,"%s" % current_level)
    53 context.portal_workflow.doActionFor(level,'open')
    54 study_session = context.getSessionString()
    55 level.getContent().edit(mapping={'session': study_session})
    56 context.portal_workflow.doActionFor(level,'close_for_edit')
     51if level_created == current_level:
     52    level = getattr(context,"%s" % current_level)
     53else:
     54    context.invokeFactory('StudentStudyLevel',"%s" % current_level)
     55    level = getattr(context,"%s" % current_level)
     56    context.portal_workflow.doActionFor(level,'open')
     57    study_session = context.getSessionString()
     58    level.getContent().edit(mapping={'session': study_session})
     59    context.portal_workflow.doActionFor(level,'close_for_edit')
     60    response.redirect("%s?level_created=%s" % (context.absolute_url(),current_level))
    5761results = context.results_import(matric_no = student.matric_no)
    5862if results:
     
    9195        context.portal_workflow.doActionFor(course_result,'open')
    9296        course_result.getContent().edit(mapping=d)
    93 res = context.portal_catalog(portal_type="Certificate", id = cert_id)
    94 l = []
    95 if res:
    96     cert = res[0]
    97     path = cert.getPath()
    98     query = Eq("path",path) &\
    99             Eq('portal_type','CertificateCourse') &\
    100             Eq('SearchableText', "%s" % current_level)
    101     courses = aq_portal(query)
    102     for c in courses:
    103         d = context.getCourseInfo(c.getId)
    104         cr_id = level.invokeFactory('StudentCourseResult',c.getId)
    105         course_result = getattr(level,cr_id)
    106         context.portal_workflow.doActionFor(course_result,'open')
    107         d['core_or_elective'] = getattr(c.getObject().getContent(),'core_or_elective')
    108         course_result.getContent().edit(mapping=d)
    109 
     97level['create_course_results'](cert_id,current_level)
     98##res = context.portal_catalog(portal_type="Certificate", id = cert_id)
     99##l = []
     100##if res:
     101##    cert = res[0]
     102##    path = cert.getPath()
     103##    #set_trace()
     104##    query = Eq("path","%s/%s" % (path,current_level)) &\
     105##            Eq('portal_type','CertificateCourse')
     106##    courses = aq_portal(query)
     107##    for c in courses:
     108##        d = context.getCourseInfo(c.getId)
     109##        cr_id = level.invokeFactory('StudentCourseResult',c.getId)
     110##        course_result = getattr(level,cr_id)
     111##        context.portal_workflow.doActionFor(course_result,'open')
     112##        d['core_or_elective'] = getattr(c.getObject().getContent(),'core_or_elective')
     113##        course_result.getContent().edit(mapping=d)
     114       
    110115return response.redirect("%s/%s" % (context.absolute_url(),current_level))
    111116
Note: See TracChangeset for help on using the changeset viewer.