Changeset 2747


Ignore:
Timestamp:
23 Nov 2007, 17:09:05 (17 years ago)
Author:
joachim
Message:

create level during course_results import

Location:
WAeUP_SRP/base
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • WAeUP_SRP/base/WAeUPTables.py

    r2738 r2747  
    13231323        for brain in course_results:
    13241324            d = {}
    1325             credits += int(brain.credits)
     1325            if brain.credits.isdigit():
     1326                credits += int(brain.credits)
    13261327            for field in self.schema():
    13271328                d[field] = getattr(brain,field,'')
  • WAeUP_SRP/base/WAeUPTool.py

    r2746 r2747  
    457457    ###)
    458458
    459     security.declarePublic('checkPassword')
     459    security.declarePublic('checkPassword') ###(
    460460    def checkPassword(self,student_id,password):
    461461        student_entry = getattr(self.portal_directories.students,student_id,None)
     
    463463            return False
    464464        return getattr(student_entry,"password","not set") == password
    465 
    466     security.declarePublic('checkGenericPassword')
     465    ###)
     466
     467    security.declarePublic('checkGenericPassword') ###(
    467468    def checkGenericPassword(self,member_id):
    468469        member_entry = getattr(self.portal_directories.members,member_id,None)
     
    477478            logger.info('Member %s tried to log in with unsecure password %s' %(member_id,password))
    478479        return is_unsecure
    479 
     480    ###)
    480481
    481482    security.declareProtected(ModifyPortalContent,'editPassword') ###(
     
    493494        transaction.commit()
    494495    ###)
    495 
    496496
    497497    security.declarePublic('loadStudentFoto') ###(
     
    14341434    def mass_create_course_result(self,mapping):
    14351435        #import pdb;pdb.set_trace()
     1436        students_folder = self.portal_url.getPortalObject().campus.students
    14361437        if getattr(self,'_v_courses',None) is None:
    14371438            res = self.courses_catalog()
     
    14391440            for brain in res:
    14401441                self._v_courses[brain.code] = brain
     1442        if getattr(self,'_v_level_created',None) is None:
     1443            self._v_level_created = []
    14411444        course_id = mapping.get('code')
    14421445        if course_id not in self._v_courses.keys():
     
    14541457        if id_field != "student_id":
    14551458            mapping['student_id'] = res[0].id
     1459        if mapping['student_id'] not in self._v_level_created:
     1460            try:
     1461                context = getattr(getattr(students_folder,
     1462                                          "%(student_id)s" % mapping),
     1463                                  'study_course')
     1464            except:
     1465                return '', "could not create level %(level_id)s for %(student_id)s" % mapping
     1466            if mapping['level_id'] not in context.objectIds():
     1467                context.invokeFactory('StudentStudyLevel',"%(level_id)s" % mapping)
     1468                level = getattr(context,"%(level_id)s" % mapping)
     1469                self.portal_workflow.doActionFor(level,'open')
     1470                level.getContent().edit(mapping={'session': "%(session_id)s" % mapping})
     1471                self.portal_workflow.doActionFor(level,'close_for_edit')
     1472            self._v_level_created += mapping['student_id'],
    14561473        mapping['key'] = key = "%(student_id)s|%(level_id)s|%(code)s" % mapping
    14571474        for k in ('semester','credits',):
Note: See TracChangeset for help on using the changeset viewer.