Index: WAeUP_SRP/base/WAeUPTool.py
===================================================================
--- WAeUP_SRP/base/WAeUPTool.py	(revision 2264)
+++ WAeUP_SRP/base/WAeUPTool.py	(revision 2265)
@@ -990,4 +990,30 @@
     ###)
 
+    security.declareProtected(ModifyPortalContent,'mass_create_course') ###(
+    def mass_create_course(self,mapping):
+        if getattr(self,'_v_course_list',None) is None:
+            self._v_course_list = []
+        if getattr(self,'_v_departments',None) is None:
+            res = self.portal_catalog(portal_type = "Department")
+            self._v_departments = {}
+            for d in res:
+                self._v_departments[d.getId] = d.getObject()
+        did = mapping['department_code']
+        d = self._v_departments.get(did,None)
+        if d is None:
+            return '', "No Department with ID: %s" % fid
+        course_id = mapping.get('code')
+        if course_id in self._v_course_list:
+            return '', "Duplicate Department ID: %s" % did
+        c = getattr(d,course_id,None)
+        if c is not None:
+            return '', "Duplicate Department ID: %s" % did
+        d.invokeFactory('Course', course_id)
+        self._v_course_list.append(course_id)
+        c = getattr(d,course_id)
+        c.getContent().edit(mapping=mapping)
+        return course_id,''
+    ###)
+
     field2types_student = {   ###(
                       'StudentApplication':
@@ -1147,8 +1173,8 @@
             editable_keys.remove('matric_no')
 
-        ## included only to change wf state from admitted to returning
-        #if res[0].review_state not in ('admitted','objection_raised'):
-        #    return '%s' % res[0].id ,"student is not in state admitted or objection_raised"
-        ## end inclusion
+        # included only to change wf state from admitted to returning
+        if res[0].review_state not in ('admitted','objection_raised'):
+            return '%s' % res[0].id ,"student is not in state admitted or objection_raised"
+        # end inclusion
 
         sid = res[0].id
@@ -1156,4 +1182,5 @@
         f2t = self.field2types_student
         d = {}
+        #import pdb;pdb.set_trace()
         any_change = False
         for pt in f2t.keys():
@@ -1183,24 +1210,24 @@
 
 
-        ## included only to change wf state from admitted to returning
-        #    if res[0].review_state in ('admitted','objection_raised'):
-        #        new_state = f2t[pt]['wf_transition_return']
-        #        sub_obj = getattr(student_obj,f2t[pt]['id'],None)
-        #        if sub_obj and new_state != "remain":
-        #            try:
-        #                self.portal_workflow.doActionFor(sub_obj,new_state,dest_container=sub_obj)
-        #            except:
-        #                #logger.info('%s, wf transition %s of %s failed' % (sid,new_state,sub_obj.id))
-        #                pass
-        #if res[0].review_state in ('admitted','objection_raised'):
-        #    wfaction = 'return'
-        #    try:
-        #        self.portal_workflow.doActionFor(student_obj,wfaction)
-        #        logger.info('%s, wf state changed' % sid)
-        #        any_change = True
-        #    except:
-        #        logger.info('%s, wf transition failed, old state = %s' % (sid,res[0].review_state))
-        #        pass
-        ## end inclusion
+        # included only to change wf state from admitted to returning
+            if res[0].review_state in ('admitted','objection_raised'):
+                new_state = f2t[pt]['wf_transition_return']
+                sub_obj = getattr(student_obj,f2t[pt]['id'],None)
+                if sub_obj and new_state != "remain":
+                    try:
+                        self.portal_workflow.doActionFor(sub_obj,new_state,dest_container=sub_obj)
+                    except:
+                        #logger.info('%s, wf transition %s of %s failed' % (sid,new_state,sub_obj.id))
+                        pass
+        if res[0].review_state in ('admitted','objection_raised'):
+            wfaction = 'return'
+            try:
+                self.portal_workflow.doActionFor(student_obj,wfaction)
+                logger.info('%s, wf state changed' % sid)
+                any_change = True
+            except:
+                logger.info('%s, wf transition failed, old state = %s' % (sid,res[0].review_state))
+                pass
+        # end inclusion
 
 
@@ -1282,5 +1309,5 @@
                 format_error = format + ',"%(Error)s"'
                 format = '"%(id)s",'+ format
-
+                           
             dm = DataModel(item, adapters,context=self)
             ds = DataStructure(data=item,datamodel=dm)
