## Script (Python) "search_pins" ##bind container=container ##bind context=context ##bind namespace= ##bind script=script ##bind subpath=traverse_subpath ##parameters=REQUEST ##title= ## # $Id: fixLevelForNewStudents.py 1473 2007-02-23 08:12:11Z joachim $ """ list Students for ClearanceOfficers """ request = context.REQUEST session = request.SESSION response = request.RESPONSE setheader = request.RESPONSE.setHeader def rwrite(s): response.setHeader('Content-type','text/html; charset=ISO-8859-15') response.write(s) mtool = context.portal_membership member = mtool.getAuthenticatedMember() retcat = context.returning_import rcat = context.results_import students_cat = context.students_catalog from Products.AdvancedQuery import Eq, Between, Le,In aq_students = students_cat.evalAdvancedQuery aq_portal = context.portal_catalog.evalAdvancedQuery students = context.portal_url.getPortalObject().campus.students count = 0 ##query = Eq('portal_type','Student') & In('review_state',('admitted', ## 'clearance_requested', ## 'cleared_and_validated', ## 'objection_raised', ## ) ##res = aq_portal(query) query = Eq('level','100') res = aq_students(query) count = 0 for sbrain in res: if sbrain.entry_mode == "": student_obj = getattr(students,sbrain.id) if not student_obj.hasObject('application'): rwrite("%s %s %s application not found
" % (sbrain.id,sbrain.entry_mode,level)) continue app_doc = student_obj.application.getContent() entry_mode = app_doc.entry_mode else: entry_mode = sbrain.entry_mode if entry_mode == "DE": level = "200" else: level = "100" students_cat.modifyRecord(id=sbrain.id, level=level, entry_mode=entry_mode) if not student_obj.hasObject('study_course'): rwrite("%s %s %s study_course not found
" % (sbrain.id,sbrain.entry_mode,level)) continue student_obj.study_course.getContent().edit(mapping={'current_level': level, 'current_verdict': 'na'}) count += 1 rwrite("%s: %s %s %s
" % (count,sbrain.id,entry_mode,level))