Index: WAeUP_SRP/base/WAeUPImport.py
===================================================================
--- WAeUP_SRP/base/WAeUPImport.py	(revision 3247)
+++ WAeUP_SRP/base/WAeUPImport.py	(revision 3248)
@@ -60,4 +60,6 @@
         self.current = DateTime.DateTime().strftime("%d-%m-%y_%H_%M_%S")
         self.waeup_tool = waeup_tool
+        self.students_folder = waeup_tool.portal_url.getPortalObject().campus.students
+        self.academics_folder = waeup_tool.portal_url.getPortalObject().campus.academics
         self.schema_tool = getToolByName(waeup_tool, 'portal_schemas')
         self.layout_tool = getToolByName(waeup_tool, 'portal_layouts')
@@ -178,22 +180,22 @@
             self._v_certificate_list = []
         if getattr(self,'_v_department_certificates',None) is None:
-            res = self.portal_catalog(portal_type = "Department")
+            departments = self.portal_catalog(portal_type = "Department")
             self._v_department_certificates = {}
-            for d in res:
-                self._v_department_certificates[d.getId] = getattr(d.getObject(),"certificates",None)
-        did = mapping['department_code']
-        msg = ''
-        while True:
-            d = self._v_department_certificates.get(did,None)
-            if d is None:
-                msg =  "no department with id: %s" % did
-                break
-            certificate_id = mapping.get('code')
+            for d in departments:
+                certificates_folder = getattr(d.getObject(),"certificates",None)
+                self._v_department_certificates[d.getId] = certificates_folder.objectIds() 
+        department_id = mapping['department_code']
+        msg = ''
+        certificate_id = mapping.get('code')
+        while True:
+            department_certificates = self._v_department_certificates.get(department_id,None)
+            if department_certificates is None:
+                msg =  "No Department with ID: %s" % department_id
+                break
             if certificate_id in self._v_certificate_list:
-                msg =  "duplicate certificate id: %s" % did
-                break
-            c = getattr(d,certificate_id,None)
-            if c is not None:
-                msg =  "duplicate certificate id: %s" % did
+                msg =  "Duplicate Certificate ID: %s" % department_id
+                break
+            if certificate_id in department_certificates:
+                msg =  "Duplicate Certificate ID: %s" % department_id
                 break
             try:
@@ -267,11 +269,11 @@
     def edit(self,mapping): ###(
         course_id = mapping.get('code','')
-        res = self.portal_catalog(id=course_id)
-        while True:
-            if not res:
+        course = self.courses_catalog.getRecordByKey(course_id)
+        while True:
+            if course is None:
                 msg =  "no course with id: %s" % course_id
                 break
-            c = res[0].getObject()
-            c.getContent().edit(mapping=mapping)
+            course_object = getattr(getattr(self.academics_folder,course.department),course_id)
+            course_object.getContent().edit(mapping=mapping)
             break
         return course_id,msg,mapping
@@ -289,29 +291,30 @@
         id_field_found = False
         msg = ''
+        student_record = None
+        id_count = 0
         for id_key in ('id','matric_no'):
             id_field = mapping.get(id_key,'')
             if id_field:
-                if id_field_found:
-                    msg = "%s must not be provided" % id_key
-                    break
+                id_count += 1
                 search_key = id_key
                 search_field = id_field
-                id_field_found = True
-        #if search_key == "student_id":
-        #    search_key = 'id'
-        if not id_field_found:
-            msg = "neither id nor matric_no provided"
-            return None,msg
-        query = Eq(search_key,search_field)
-        res = self.students_catalog.evalAdvancedQuery(query)
-        student_record = None
-        if res:
-            student_record = res[0]
-            if search_key == "matric_no":
-                mapping['id'] = student_record.id
-            elif search_key == "id":
-                mapping['matric_no'] = student_record.matric_no
-        else:
-            msg = "no student with %(search_key)s %(search_field)s" % vars()
+        while True:
+            if id_count > 1:
+                msg = "both id and matric_no are provided"
+                break
+            elif id_count == 0:
+                msg = "neither id nor matric_no provided"
+                break
+            query = Eq(search_key,search_field)
+            res = self.students_catalog.evalAdvancedQuery(query)
+            if res:
+                student_record = res[0]
+                if search_key == "matric_no":
+                    mapping['id'] = student_record.id
+                elif search_key == "id":
+                    mapping['matric_no'] = student_record.matric_no
+            else:
+                msg = "no student with %(search_key)s %(search_field)s" % vars()
+            break
         return student_record,msg
     ###)
@@ -337,6 +340,6 @@
                 break
             student_id = student_record.id
-            level_id = mapping['level_id']
-            code = mapping['code']
+            level_id = mapping.get('level_id','')
+            code = mapping.get('code','')
             if student_id not in self._v_level_created:
                 try:
@@ -374,5 +377,4 @@
 
     def edit(self,mapping): ###(
-        #import pdb;pdb.set_trace()
         msg = ''
         key = ''
@@ -381,12 +383,6 @@
             if msg:
                 break
-            if not mapping.get('level_id',''):
-                msg =  "level_id is missing"
-                break
-            if not mapping.get('code',''):
-                msg =  "code is missing"
-                break
-            student_id = student_record.id
-            level_id = mapping['level_id']
+            level_id = mapping.get('level_id','')
+            code = mapping.get('code','')
             code = mapping['code']
             mapping['key'] = key = "%(student_id)s|%(level_id)s|%(code)s" % vars()
@@ -406,13 +402,7 @@
             if msg:
                 break
-            if not mapping.get('level_id',''):
-                msg =  "level_id is missing"
-                break
-            if not mapping.get('code',''):
-                msg =  "code is missing"
-                break
             student_id = student_record.id
-            level_id = mapping['level_id']
-            code = mapping['code']
+            level_id = mapping.get('level_id','')
+            code = mapping.get('code','')
             key = "%(student_id)s|%(level_id)s|%(code)s" % vars()
             if self.course_results.getRecordByKey(key) is None:
Index: WAeUP_SRP/base/WAeUPTool.py
===================================================================
--- WAeUP_SRP/base/WAeUPTool.py	(revision 3247)
+++ WAeUP_SRP/base/WAeUPTool.py	(revision 3248)
@@ -1478,11 +1478,11 @@
             total += 1
             import_mode = item.get('import_mode','edit')
-            if (import_mode in importer.required_modes and 
-                not set(importer.required_keys[import_mode]).issubset(set(import_keys))):
-                diff2import = set(importer.required_keys[import_mode]).difference(set(import_keys))
-                error_string += 'required key(s): "%s" not found in heading' % ", ".join(diff2import)
             import_method = getattr(importer, '%(import_mode)s' % vars(),None )
             if import_method is None:
                 error_string += "no %(import_mode)s " % vars()
+            elif (import_mode in importer.required_modes and 
+                not set(importer.required_keys[import_mode]).issubset(set(item.keys()))):
+                diff2import = set(importer.required_keys[import_mode]).difference(set(item.keys()))
+                error_string += 'required key(s): "%s" not found in record' % ", ".join(diff2import)
             else:
                 for k in import_keys:
