Changeset 3781 for WAeUP_SRP/trunk


Ignore:
Timestamp:
22 Nov 2008, 15:34:16 (16 years ago)
Author:
Henrik Bettermann
Message:

course_result_list.py : csv download of course results lists
ti_507_2_resolve.py : new script to reindex the mode index in students_catalog
WAeUPTables.py: enable caching for reindexing the students_catalog, but it's still very slow (therefore ti_507_2_resolve.py)

Location:
WAeUP_SRP/trunk
Files:
2 added
1 edited

Legend:

Unmodified
Added
Removed
  • WAeUP_SRP/trunk/WAeUPTables.py

    r3780 r3781  
    10281028
    10291029    def reindexIndex(self, name, REQUEST,pghandler=None): ###(
     1030        if not hasattr(self,'_v_certificates'):
     1031            self._v_certificates = self.fill_certificates_dict()
    10301032        if isinstance(name, str):
    10311033            name = (name,)
     
    10331035        reindex_special = []
    10341036        for n in name:
    1035             if n in ("review_state","registered_courses"):
     1037            if n in ("review_state"):
    10361038                reindex_special.append(n)
    10371039            else:
     
    10431045                            reindextypes[pt]= [n]
    10441046                        break
    1045         cached_data = {}
    1046         if set(name).intersection(set(('faculty','department','end_level'))):
    1047             cached_data = self.fill_certificates_dict()
     1047        #cached_data = {}
     1048        #if set(name).intersection(set(('faculty','department','end_level','mode'))):
     1049        #    cached_data = self.fill_certificates_dict()
    10481050        students = self.portal_catalog(portal_type="Student")
    10491051        if hasattr(self,'portal_catalog_real'):
     
    10601062            student_brain = students[i]
    10611063            student_object = student_brain.getObject()
    1062             # query = Eq('path',student_brain.getPath())
    1063             # sub_brains_list = aq_portal(query)
    1064             # sub_brains = {}
    1065             # for sub_brain in sub_brains_list:
    1066             #     sub_brains[sub_brain.portal_type] = sub_brain
    1067             # student_path = student_brain.getPath()
    10681064            data = {}
    10691065            modified = False
     
    10771073                try:
    10781074                    doc = getattr(student_object,self.affected_types[pt]['id']).getContent()
    1079                     #doc = sub_brains[pt].getObject().getContent()
    1080                     # path = "%s/%s" % (student_path,self.affected_types[pt]['id'])
    1081                     # doc = self.unrestrictedTraverse(path).getContent()
    10821075                    sub_objects = True
    10831076                except:
     
    10851078                for field in set(name).intersection(self.affected_types[pt]['fields']):
    10861079                    if hasattr(self,'get_from_doc_%s' % field):
    1087                         data[field] = getattr(self,'get_from_doc_%s' % field)(doc,
    1088                                                                               cached_data=cached_data)
     1080                        data[field] = getattr(self,'get_from_doc_%s' % field)(doc)
    10891081                    else:
    10901082                        data[field] = getattr(doc,field)
     
    11001092                                             import_record.Lastname)
    11011093                data['jamb_reg_no'] = import_record.Entryregno
    1102             #if reindex_special and 'registered_courses' in reindex_special:
    1103             #    try:
    1104             #        study_course = getattr(student_object,"study_course")
    1105             #        level_ids = study_course.objectIds()
    1106             #    except:
    1107             #        continue
    1108             #    if not level_ids:
    1109             #        continue
    1110             #    modified = True
    1111             #    level_ids.sort()
    1112             #    course_ids = getattr(study_course,level_ids[-1]).objectIds()
    1113             #    courses = []
    1114             #    for c in course_ids:
    1115             #        if c.endswith('_co'):
    1116             #            courses.append(c[:-3])
    1117             #        else:
    1118             #            courses.append(c)
    1119             #    data['registered_courses'] = courses
    11201094            if modified:
    11211095                self.modifyRecord(**data)
     
    11301104        students = self.portal_catalog(portal_type="Student")
    11311105        num_objects = len(students)
    1132         cached_data = self.fill_certificates_dict()
     1106        #cached_data = self.fill_certificates_dict()
     1107        if not hasattr(self,'_v_certificates'):
     1108            self._v_certificates = self.fill_certificates_dict()
    11331109        if pghandler:
    11341110            pghandler.init('Refreshing catalog: %s' % self.absolute_url(1), num_objects)
Note: See TracChangeset for help on using the changeset viewer.