## Script (Python) "search_pins" ##bind container=container ##bind context=context ##bind namespace= ##bind script=script ##bind subpath=traverse_subpath ##parameters=REQUEST ##title= ## # $Id: fixLevel.py 1250 2007-01-09 17:19:20Z joachim $ """ list Students for ClearanceOfficers """ request = REQUEST wftool = context.portal_workflow mtool = context.portal_membership member = mtool.getAuthenticatedMember() roles = member.getRolesInContext(context) retcat = context.returning_import rcat = context.results_import scat = context.students_catalog from Products.AdvancedQuery import Eq, Between, Le,In aq_students = context.students_catalog.evalAdvancedQuery if str(member) not in ('admin','joachim'): return count = 0 #from Products.zdb import set_trace;set_trace() values = scat.uniqueValuesFor('level') #query = ~ In("level",('100', '200', '300', '400', '500', '600')) query = In("level",('',)) res = aq_students(query) #from Products.zdb import set_trace;set_trace() modified = [] modified.append("%d to change" % len(res)) list = [] for sbrain in res: list.append((sbrain.id,sbrain.matric_no)) for id,m in list: erg = context.results_import(matric_no=m) if erg and erg[0].Level: context.students_catalog.modifyRecord(id = id, level=erg[0].Level) modified.append("%s, %s" % (id,m)) else: modified.append("no results for %s, %s" % (id,m)) return '\n'.join(modified)