source: WAeUP_SRP/trunk/skins/waeup_student/display_session_results.py @ 1171

Last change on this file since 1171 was 1166, checked in by Henrik Bettermann, 18 years ago

some corrections

  • Property svn:keywords set to Id
File size: 2.2 KB
RevLine 
[1146]1##parameters=REQUEST
2# $Id: display_session_results.py 1166 2006-12-31 18:11:47Z henrik $
3"""
4process the Application Form
5return html renderer + psm
6"""
7import DateTime
8current = DateTime.DateTime()
9pr = context.portal_registration
10
11validate = REQUEST.has_key("cpsdocument_create_button")
12
13lt = context.portal_layouts
14#pr = context.portal_registration
15
16res,psm,ds = lt.renderLayout(layout_id= 'student_session_results_search',
[1151]17                      schema_id= 'student_returning',
[1146]18                      context=context,
19                      mapping=validate and REQUEST,
20                      ob={},
21                      layout_mode='create',
22                      formaction = "display_session_results",
23                      button = "Search",
24                      commit=False,
25                      )
26if psm == 'invalid':
27    return context.display_session_results_form(rendered = res,
28                                 psm = "Please correct your input!",
29                                 #psm = "%s, %s" % (psm,ds),
30                                 firstlayout = True,
31                                 lastlayout = True,
32                                 ds = ds,
33                                 )
34elif psm == '':
35    return context.display_session_results_form(rendered = res,
36                                 psm = None,
37                                 firstlayout = True,
38                                 lastlayout = True,
39                                 ds = ds,
40                                 )
41elif psm == 'valid':
[1165]42    pass
43brains = ds.get('results')
44sem1 = []
45sem2 = []
46with_courses_cat = hasattr(context,'courses_catalog')
47fields = context.results_import.schema()
48for r in brains:
49    result = {}
50    for field in fields:
51        result[field] = getattr(r,field)
52    if with_courses_cat:
53        res = context.courses_catalog(code = r.CosCode)
54    if with_courses_cat and res:
55        result['title'] = res[0].title
56    else:
[1166]57        result['title'] = "To Be Determined"
[1165]58    if r.Semester == '2':
59        sem2.append(result)
60    else:
61        sem1.append(result)
62#from Products.zdb import set_trace;set_trace()
63results = (sem1, sem2)
64return context.session_results_anon_view(student=ds.get('student'),
65                                           results=results)
[1146]66
Note: See TracBrowser for help on using the repository browser.