Index: /WAeUP_SRP/trunk/WAeUPTool.py
===================================================================
--- /WAeUP_SRP/trunk/WAeUPTool.py	(revision 1817)
+++ /WAeUP_SRP/trunk/WAeUPTool.py	(revision 1818)
@@ -67,10 +67,19 @@
                      )
 
-    def rwrite(self,s):
+    def rwrite(self,s): ###(
         response = self.REQUEST.RESPONSE
         response.setHeader('Content-type','text/html; charset=ISO-8859-15')
         response.write("%s<br />\r\n" % s)
-
-    security.declareProtected(ModifyPortalContent,'openLog')
+    ###)
+
+    def sleep(self,secs): ###(
+        "sleep"
+        import time
+        time.sleep(secs)
+        return
+    
+###)
+
+    security.declareProtected(ModifyPortalContent,'openLog') ###(
     def openLog(self,name):
         """open a log file"""
@@ -83,9 +92,12 @@
         return log
 
-    security.declareProtected(ModifyPortalContent,'writeLog')
+###)
+
+    security.declareProtected(ModifyPortalContent,'writeLog') ###(
     def writeLog(self,logfile,s):
         """write to the log file"""
         logfile.write(s)
 
+###)
 
     def generateStudentId(self,letter): ###(
@@ -169,5 +181,5 @@
         app_doc.manage_addFile('passport',
                                file=outfile,
-                               title="%s.jpg" % matric_no)
+                               title="%s.jpg" % filename)
         return "successfully loaded passport picture"
     ###)
@@ -740,14 +752,14 @@
 
     security.declareProtected(ModifyPortalContent,'importStudent') ###(
-    def importStudent(self,dict):
+    def importStudent(self,mapping):
         "create a students record due import"
         logger = logging.getLogger('WAeUPTool.importStudent')
         students_folder = self.portal_url.getPortalObject().campus.students
-        jamb_reg_no = dict.get('jamb_reg_no',None)
+        jamb_reg_no = mapping.get('jamb_reg_no',None)
         if jamb_reg_no:
             res = self.students_catalog(jamb_reg_no = jamb_reg_no)
             if res:
                 return '',"jamb_reg_no exists"
-        matric_no = dict.get('matric_no',None)
+        matric_no = mapping.get('matric_no',None)
         if matric_no:
             res = self.students_catalog(matric_no = matric_no)
@@ -760,5 +772,5 @@
         d = {}
         d['jamb_sex']  = 'M'
-        if dict.get('sex'):
+        if mapping.get('sex'):
             d['jamb_sex']  = 'F'
         for pt in f2t.keys():
@@ -768,5 +780,10 @@
             d['Title'] = f2t[pt]['title']
             for field in f2t[pt]['fields']:
-                d[field] = dict.get(field,'')
+                d[field] = mapping.get(field,'')
+            if pt == "StudyCourse":
+                for von,zu in (('entry_mode','current_mode'),
+                               ('entry_session','current_session')):
+                    if mapping.get(zu,None) is None and mapping.get(von,None) is not None:
+                        d[zu] = mapping[von]
             sub_doc.edit(mapping = d)
             new_state = f2t[pt]['wf_transition']
@@ -780,11 +797,11 @@
 
     security.declareProtected(ModifyPortalContent,'importEditStudent') ###(
-    def importEditStudent(self,dict):
+    def importEditStudent(self,mapping):
         "edit a students record due import"
         logger = logging.getLogger('WAeUPTool.importEditStudent')
         students_folder = self.portal_url.getPortalObject().campus.students
-        sid = dict.get('id',None)
-        jamb_reg_no = dict.get('jamb_reg_no',None)
-        matric_no = dict.get('matric_no',None)
+        sid = mapping.get('id',None)
+        jamb_reg_no = mapping.get('jamb_reg_no',None)
+        matric_no = mapping.get('matric_no',None)
         if sid:
             res = self.students_catalog(id = sid)
@@ -813,5 +830,5 @@
         d = {}
         d['jamb_sex']  = 'M'
-        if dict.get('sex'):
+        if mapping.get('sex'):
             d['jamb_sex']  = 'F'
         for pt in f2t.keys():
@@ -827,5 +844,5 @@
             d['Title'] = f2t[pt]['title']
             for field in f2t[pt]['fields']:
-                d[field] = dict.get(field,'')
+                d[field] = mapping.get(field,'')
             sub_doc.edit(mapping = d)
             # new_state = f2t[pt]['wf_transition']
@@ -911,6 +928,4 @@
             error_string = ""
             for k in import_keys:
-                # if k == "birthday":
-                #     from pdb import set_trace; set_trace()
                 if not validators[k](ds):
                     error_string += " %s : %s" % (k,ds.getError(k))
