Changeset 2320


Ignore:
Timestamp:
5 Oct 2007, 19:11:47 (17 years ago)
Author:
joachim
Message:

make import_certificate_courses faster

File:
1 edited

Legend:

Unmodified
Added
Removed
  • WAeUP_SRP/base/WAeUPTool.py

    r2319 r2320  
    10821082    security.declareProtected(ModifyPortalContent,'mass_create_certificate_course') ###(
    10831083    def mass_create_certificate_course(self,mapping):
     1084        if getattr(self,'_v_courses',None) is None:
     1085            res = self.courses_catalog()
     1086            self._v_courses= [course.code for course in res] 
    10841087        if getattr(self,'_v_ceritficates',None) is None:
    10851088            res = self.portal_catalog(portal_type = "Certificate")
     
    10881091                self._v_certificates[cert.getId] = cert.getObject()
    10891092        certificate_course_id = mapping.get('code')
    1090         if not self.courses_catalog(code = certificate_course_id):
     1093        if certificate_course_id not in self._v_courses:
    10911094            return '', "No Course with ID: %s" % certificate_course_id
    10921095        cert_id = mapping['certificate_code']
Note: See TracChangeset for help on using the changeset viewer.