Index: /WAeUP_SRP/base/WAeUPTool.py
===================================================================
--- /WAeUP_SRP/base/WAeUPTool.py	(revision 2539)
+++ /WAeUP_SRP/base/WAeUPTool.py	(revision 2540)
@@ -641,19 +641,21 @@
         if brain.status != "admitted":
             logger.info('status of %s is %s' % (brain.reg_no,brain.status))
+            return
         pin_parts = brain.pin.split('-')
         if len(pin_parts) != 3:
             logger.info('invalid pin %s for %s' % (brain.pin,brain.reg_no))
-        student_id = self.generateStudentId(letter)
+            return
+        student_id = self.generateStudentId('?')
         students_folder.invokeFactory('Student', student_id)
         student_object = getattr(students_folder,student_id)
         password = pin_parts[2]
         self.makeStudentMember(student_id,password = password)
-        student.manage_setLocalRoles(sid, ['Owner',])
-        logger.info("creating %s reg_no %s" % (student_id,brain.reg_no))
+        student_object.manage_setLocalRoles(student_id, ['Owner',])
+        #logger.info("creating %s reg_no %s" % (student_id,brain.reg_no))
         #
         # application
         #
-        student_obj.invokeFactory('StudentApplication','application')
-        application = student_obj.application
+        student_object.invokeFactory('StudentApplication','application')
+        application = student_object.application
         self.portal_workflow.doActionFor(application,'open',dest_container=application)
         da = {'Title': 'Application Data'}
@@ -661,8 +663,15 @@
         da['entry_mode'] = brain.entry_mode
         da['jamb_lastname'] = brain.lastname
-        da['jamb_sex'] = brain.sex
-        da['jamb_lga'] = brain.lga
+        sex = 'M'
+        if brain.sex:
+            sex = 'F'
+        da['jamb_sex'] = sex
+        da['app_ac_pin'] = brain.pin
+        state_lga = brain.lga.split('_')
+        da['state_lga'] = state_lga[0]
+        da['jamb_lga'] = state_lga[-1]
+        #da['jamb_score'] = brain.????
         da['app_email'] = brain.email
-        da['app_mobile'] = brain.phone_nr
+        da['app_mobile'] = brain.phone
         application.getContent().edit(mapping=da)
         self.portal_workflow.doActionFor(application,'close',dest_container=application)
@@ -670,11 +679,11 @@
         # personal
         #
-        student_obj.invokeFactory('StudentPersonal','personal')
-        personal = student_obj.personal
+        student_object.invokeFactory('StudentPersonal','personal')
+        personal = student_object.personal
         self.portal_workflow.doActionFor(personal,'open',dest_container=personal)
         dp = {'Title': 'Personal Data'}
         dp['sex'] = brain.sex
         dp['email'] = brain.email
-        dp['phone'] = brain.phone_nr
+        dp['phone'] = brain.phone
         dp['lastname'] = brain.lastname
         personal.getContent().edit(mapping=dp)
@@ -682,6 +691,6 @@
         # clearance
         #
-        student_obj.invokeFactory('StudentClearance','clearance')
-        clearance = student_obj.clearance
+        student_object.invokeFactory('StudentClearance','clearance')
+        clearance = student_object.clearance
         self.portal_workflow.doActionFor(clearance,'open',dest_container=clearance)
         dc = {'Title': 'Clearance/Eligibility Record'}
@@ -692,6 +701,6 @@
         # study Course
         #
-        student_obj.invokeFactory('StudentStudyCourse','study_course')
-        studycourse = student_obj.study_course
+        student_object.invokeFactory('StudentStudyCourse','study_course')
+        studycourse = student_object.study_course
         self.portal_workflow.doActionFor(studycourse,'open',dest_container=studycourse)
         dsc = {}
@@ -702,10 +711,10 @@
         #
         # payments folder
-        student_obj.invokeFactory('PaymentsFolder','payments')
-        payments = getattr(student_obj,'payments')
+        student_object.invokeFactory('PaymentsFolder','payments')
+        payments = getattr(student_object,'payments')
         dpay = {}
         dpay['Title'] = 'Payments'
         payments.getContent().edit(mapping=dpay)
-        wftool.doActionFor(payments,'open')
+        self.portal_workflow.doActionFor(payments,'open')
         return student_id
     ###)
Index: /WAeUP_SRP/base/skins/waeup_student/admitStudents.py
===================================================================
--- /WAeUP_SRP/base/skins/waeup_student/admitStudents.py	(revision 2540)
+++ /WAeUP_SRP/base/skins/waeup_student/admitStudents.py	(revision 2540)
@@ -0,0 +1,68 @@
+## Script (Python) "admitStudents"
+##bind container=container
+##bind context=context
+##bind namespace=
+##bind script=script
+##bind subpath=traverse_subpath
+##parameters=
+##title=
+##
+# $Id$
+"""
+"""
+try:
+    from Products.zdb import set_trace
+except:
+    def set_trace():
+        pass
+
+mtool = context.portal_membership
+member = mtool.getAuthenticatedMember()
+if str(member) not in ('admin','joachim'):
+    return
+
+
+import logging
+import DateTime
+logger = logging.getLogger('Skins.admitStudents')
+from Products.AdvancedQuery import Eq, Between, Le,In
+aq_applicants = context.applicants_catalog.evalAdvancedQuery
+request = context.REQUEST
+session = request.SESSION
+response = request.RESPONSE
+setheader = request.RESPONSE.setHeader
+def rwrite(s):
+    response.setHeader('Content-type','text/html; charset=ISO-8859-15')
+    response.write("%s<br>\n\r" % s)
+
+brains = aq_applicants(In('status',('admitted'),)) 
+total = len(brains)
+logger.info("found %d students" % (total))
+count = 0
+admitted = 0
+cocount = 0
+commit_after = 2
+d = {'status': 'created'}
+reg_nos = [brain.reg_no for brain in brains]
+for reg_no in reg_nos:
+    count += 1
+    if admitted and not admitted % commit_after:
+        context.waeup_tool.doCommit()
+        logger.info("Committing %s transactions, total %s" % (commit_after,count))
+        cocount += 1
+        if cocount > 3:
+            break
+    brain = aq_applicants(Eq('reg_no',reg_no))[0]
+    #logger.info("start creating  objects of student %s" % (brain.reg_no))
+    sid = d['student_id'] = context.waeup_tool.admitOneStudent(brain)
+    if sid is not None:
+        d['reg_no'] = reg_no
+        context.applicants_catalog.modifyRecord(**d)
+        logger.info("created objects of student %s with id %s" % (reg_no,sid))
+        admitted += 1
+    else:
+        logger.info("could not create  objects of student %s with pin " % (reg_no,brain.pin))
+        
+msg = "finished admitting %d students" % (admitted)
+logger.info(msg)
+rwrite(msg)
