Changeset 2776


Ignore:
Timestamp:
26 Nov 2007, 22:56:37 (17 years ago)
Author:
joachim
Message:

add student_id

File:
1 edited

Legend:

Unmodified
Added
Removed
  • WAeUP_SRP/base/WAeUPTool.py

    r2775 r2776  
    14561456            return '', "no student with %(id_key)s %(id_field)s" % vars()
    14571457        student_rec = res[0]
    1458         # if id_field != "student_id":
    1459         #     mapping['student_id'] = res[0].id
     1458        if id_field != "student_id":
     1459            mapping['student_id'] = student_rec.id
    14601460        student_id = student_rec.id
    14611461        level_id = mapping['level_id']
     
    15041504        # if course_id not in self._v_courses.keys():
    15051505        #     return '', "No course with ID: %s" % did
    1506         # id_key = ''
    1507         # for id_key in ('student_id','matric_no'):
    1508         #     id_field = mapping.get(id_key,None)
    1509         #     if id_field is not None:
    1510         #         student_id = id_field
    1511         #         break
    1512         # query = Eq(id_key,id_field)
    1513         # res = self.students_catalog.evalAdvancedQuery(query)
    1514         # if not res:
    1515         #     return '', "No student with %(id_field)s: %(id_key)s" % vars()
    1516         # if id_field != "student_id":
    1517         #     mapping['student_id'] = res[0].id
    1518         students_folder = self.portal_url.getPortalObject().campus.students
    1519         student_rec = self.students_catalog.getRecordByKey(mapping['student_id'])
    1520         if student_rec is None:
     1506        id_key = ''
     1507        for id_key in ('student_id','matric_no'):
     1508            id_field = mapping.get(id_key,None)
     1509            if id_field is not None:
     1510                student_id = id_field
     1511                break
     1512        query = Eq(id_key,id_field)
     1513        res = self.students_catalog.evalAdvancedQuery(query)
     1514        if not res:
     1515            return '', "No student with %(id_field)s: %(id_key)s" % vars()
     1516        if id_field != "student_id":
     1517            mapping['student_id'] = res[0].id
     1518        if not res:
    15211519            return '', "no student with %(id_key)s %(id_field)s" % vars()
     1520        student_rec = res[0]
    15221521        student_id = student_rec.id
    15231522        level_id = mapping['level_id']
Note: See TracChangeset for help on using the changeset viewer.