1 | ## Script (Python) "search_pins" |
---|
2 | ##bind container=container |
---|
3 | ##bind context=context |
---|
4 | ##bind namespace= |
---|
5 | ##bind script=script |
---|
6 | ##bind subpath=traverse_subpath |
---|
7 | ##parameters=REQUEST |
---|
8 | ##title= |
---|
9 | ## |
---|
10 | # $Id: fixLevelForNewStudents.py 1484 2007-02-24 06:24:08Z henrik $ |
---|
11 | """ |
---|
12 | list Students for ClearanceOfficers |
---|
13 | """ |
---|
14 | |
---|
15 | request = context.REQUEST |
---|
16 | session = request.SESSION |
---|
17 | response = request.RESPONSE |
---|
18 | setheader = request.RESPONSE.setHeader |
---|
19 | |
---|
20 | def rwrite(s): |
---|
21 | response.setHeader('Content-type','text/html; charset=ISO-8859-15') |
---|
22 | response.write(s) |
---|
23 | |
---|
24 | mtool = context.portal_membership |
---|
25 | member = mtool.getAuthenticatedMember() |
---|
26 | retcat = context.returning_import |
---|
27 | rcat = context.results_import |
---|
28 | students_cat = context.students_catalog |
---|
29 | from Products.AdvancedQuery import Eq, Between, Le,In |
---|
30 | aq_students = students_cat.evalAdvancedQuery |
---|
31 | aq_portal = context.portal_catalog.evalAdvancedQuery |
---|
32 | students = context.portal_url.getPortalObject().campus.students |
---|
33 | |
---|
34 | count = 0 |
---|
35 | ##query = Eq('portal_type','Student') & In('review_state',('admitted', |
---|
36 | ## 'clearance_requested', |
---|
37 | ## 'cleared_and_validated', |
---|
38 | ## 'objection_raised', |
---|
39 | ## ) |
---|
40 | ##res = aq_portal(query) |
---|
41 | query = Eq('level','100') |
---|
42 | res = aq_students(query) |
---|
43 | count = 0 |
---|
44 | for sbrain in res: |
---|
45 | student_obj = getattr(students,sbrain.id) |
---|
46 | if sbrain.entry_mode == "": |
---|
47 | if not student_obj.hasObject('application'): |
---|
48 | rwrite("%s %s %s application not found <br />" % (sbrain.id,sbrain.entry_mode,level)) |
---|
49 | continue |
---|
50 | app_doc = student_obj.application.getContent() |
---|
51 | entry_mode = app_doc.entry_mode |
---|
52 | else: |
---|
53 | entry_mode = sbrain.entry_mode |
---|
54 | if entry_mode == "DE": |
---|
55 | level = "200" |
---|
56 | else: |
---|
57 | level = "100" |
---|
58 | students_cat.modifyRecord(id=sbrain.id, |
---|
59 | level=level, |
---|
60 | entry_mode=entry_mode) |
---|
61 | if not student_obj.hasObject('study_course'): |
---|
62 | rwrite("%s %s %s study_course not found <br />" % (sbrain.id,sbrain.entry_mode,level)) |
---|
63 | continue |
---|
64 | student_obj.study_course.getContent().edit(mapping={'current_level': level, |
---|
65 | 'current_verdict': 'N/A'}) |
---|
66 | count += 1 |
---|
67 | rwrite("%s: %s %s %s <br />" % (count,sbrain.id,entry_mode,level)) |
---|
68 | |
---|