source: WAeUP_SRP/base/skins/waeup_student/getStudyCourseInfo.py @ 2504

Last change on this file since 2504 was 2483, checked in by Henrik Bettermann, 17 years ago

don't fetch verdict from results_import if school_fee_paid

  • Property svn:keywords set to Id
File size: 2.9 KB
RevLine 
[845]1## Script (Python) "getStudyCourseInfo"
[723]2##bind container=container
3##bind context=context
4##bind namespace=
5##bind script=script
6##bind subpath=traverse_subpath
7##parameters=student=None
8##title=
9##
[805]10# $Id: getStudyCourseInfo.py 2483 2007-10-30 20:29:47Z henrik $
[723]11"""
12return Info about the Students StudyCourse
13"""
[1783]14
15mtool = context.portal_membership
16if mtool.isAnonymousUser():
17    return None
18
[1494]19try:
20    from Products.zdb import set_trace
21except:
22    def set_trace():
23        pass
24
[723]25request = context.REQUEST
26
[1490]27wftool = context.portal_workflow
[723]28path_info = request.get('PATH_INFO').split('/')
29
30info = {}
[1380]31info['is_so'] = context.isSectionOfficer()
[1650]32info['action'] = "%s" % context.absolute_url()
[723]33info['choosen_ids'] = request.get('ids',[])
[1380]34course  = info['doc'] = context.getContent()
35student_id = context.getStudentId()
36res = context.students_catalog(id = student_id)
37if not res:
38    return None
39sbrain = res[0]
[1403]40info['student'] = sbrain
[1380]41cert_id = sbrain.course
42res = context.portal_catalog(portal_type = "Certificate", id = cert_id)
43ci = {}
44if res:
45    info['cert_id'] = cert_id
46    brain = res[0]
47    ci['study_course'] = brain.getId
48    ci['title'] = brain.Title
49    pl = brain.getPath().split('/')
50    ci['faculty'] = pl[-4]
51    ci['department'] = pl[-3]
52    info['course_doc'] = ci
53else:
[1816]54    info['cert_id'] = 'N/A'
55    ci['study_course'] = 'N/A'
56    ci['title'] = 'N/A'
57    ci['faculty'] = 'N/A'
58    ci['department'] = 'N/A'
59    info['course_doc'] = ci
[2010]60
[723]61items = []
[2483]62
63if hasattr(course,'current_verdict'):
64    try:
65        info['verdict'] = context.portal_vocabularies.verdicts.get(course.current_verdict).upper()
66    except:
67        info['verdict'] = course.current_verdict
68else:
69    info['verdict'] = ''
70
71if hasattr(course,'previous_verdict'):
72    try:
73        previous_verdict = course.previous_verdict
74        info['previous_verdict'] = context.portal_vocabularies.verdicts.get(course.previous_verdict).upper()
75    except:
76        info['previous_verdict'] = course.previous_verdict
77else:
78    info['previous_verdict'] = ''
79    previous_verdict = ''
80
81
[1492]82current_level = sbrain.level
83levels = context.objectIds()
84review_state = wftool.getInfoFor(context,'review_state',None)
[1565]85student_review_state = context.getStudentReviewState()
[1571]86if review_state != 'content_addable' and student_review_state == 'school_fee_paid': #and context.isStudent():
[1492]87    wftool.doActionFor(context,'close_for_edit')
[1500]88may_register = (student_review_state in ('school_fee_paid',)) and\
[1537]89               current_level not in levels and\
[2483]90               (previous_verdict in ('A','B','C','F','J','L','M') or sbrain.level == '100' or (sbrain.mode.startswith('de') and sbrain.level == '200'))
[1565]91
[1492]92levels.sort()
93info['create_level'] = None
94if may_register:
95    info['create_level'] = current_level
96for l in levels:
97    row = {}
98    row['id'] = l
[2456]99    row['title'] = "Level %s" % l
100    #row['title'] = context.portal_vocabularies.levels_voc[l]
[1492]101    row['url'] = "%s/%s" % (context.absolute_url(),l)
102    items.append(row)
[1380]103
[723]104info['items'] = items
[1504]105
[2483]106
107
[723]108return info
[1504]109
Note: See TracBrowser for help on using the repository browser.