Index: /WAeUP_SRP/trunk/WAeUPTool.py
===================================================================
--- /WAeUP_SRP/trunk/WAeUPTool.py	(revision 1771)
+++ /WAeUP_SRP/trunk/WAeUPTool.py	(revision 1772)
@@ -204,4 +204,9 @@
         self.makeStudentMember(sid,password)
         f2t = self.student_field2types
+        #from pdb import set_trace; set_trace()
+        d = {}
+        d['jamb_sex']  = 'M'
+        if dict.get('sex'):
+            d['jamb_sex']  = 'F'
         for pt in f2t.keys():
             student_obj.invokeFactory(pt,f2t[pt]['id'])
@@ -209,12 +214,11 @@
             sub_doc = sub_obj.getContent()
             self.portal_workflow.doActionFor(sub_obj,'open',dest_container=sub_obj)
-            d = {'Title': f2t[pt]['title']}
+            d['Title'] = f2t[pt]['title']
             for field in f2t[pt]['fields']:
                 d[field] = dict.get(field,'')
-            if pt == 'StudentPersonal':
-                d['sex'] = dict.get('sex') == 'F'
             sub_doc.edit(mapping = d)
-            self.portal_workflow.doActionFor(sub_obj,'close',dest_container=sub_obj)
-
+            new_state = f2t[pt]['wf_state']
+            if new_state != "remain":
+                self.portal_workflow.doActionFor(sub_obj,new_state,dest_container=sub_obj)
         entry_session = dict.get('entry_session')
         wfaction = 'return'
@@ -656,5 +660,4 @@
                              ('jamb_reg_no',
                               'entry_mode',
-                              #'entry_level',
                               'entry_session',
                               'jamb_score',
@@ -711,6 +714,6 @@
 
 
-    security.declareProtected(ModifyPortalContent,'import_student') ###(
-    def import_student(self,dict):
+    security.declareProtected(ModifyPortalContent,'importStudent') ###(
+    def importStudent(self,dict):
         "create a students data"
         logger = logging.getLogger('WAeUPTool.create_student')
@@ -730,4 +733,8 @@
         student_obj = getattr(students_folder,sid)
         f2t = self.student_field2types
+        d = {}
+        d['jamb_sex']  = 'M'
+        if dict.get('sex'):
+            d['jamb_sex']  = 'F'
         for pt in f2t.keys():
             student_obj.invokeFactory(pt,f2t[pt]['id'])
@@ -735,9 +742,7 @@
             sub_doc = sub_obj.getContent()
             self.portal_workflow.doActionFor(sub_obj,'open',dest_container=sub_obj)
-            d = {'Title': f2t[pt]['title']}
+            d['Title'] = f2t[pt]['title']
             for field in f2t[pt]['fields']:
                 d[field] = dict.get(field,'')
-            if pt == 'StudentPersonal':
-                d['sex'] = dict.get('sex') == 'F'
             sub_doc.edit(mapping = d)
             new_state = f2t[pt]['wf_state']
@@ -768,10 +773,10 @@
         schema = stool._getOb(iname)
         if schema is None:
-            em = 'No such schema import_%s' % iname
-            logger.error('No such schema import_%s' % iname)
+            em = 'No such schema %s' % iname
+            logger.error('No such schema %s' % iname)
             return em
         layout = ltool._getOb(iname)
         if layout is None:
-            em = 'No such layout import_%s' % iname
+            em = 'No such layout %s' % iname
             logger.error(em)
             return em
@@ -779,7 +784,8 @@
         for widget in layout.keys():
             validators[widget] = layout[widget].validate
-        creator = getattr(self, 'import_%s' % name,None)
-        if creator is None:
-            em = 'No creator function create_%s' % name
+        importer_name = "import%s" % name.capitalize()
+        importer = getattr(self, '%s' % importer_name,None)
+        if importer is None:
+            em = 'No importer function %s' % importer_name
             logger.error(em)
             return em
@@ -809,9 +815,9 @@
                     return
                 s = ','.join(['"%s"' % fn for fn in import_keys])
+                open("%s/import/%s_not_imported%s.csv" % (i_home,filename,current),"a").write(s + ',"Error"'+ '\n')
+                s = '"id",' + s
                 open("%s/import/%s_imported%s.csv" % (i_home,filename,current),"a").write(s + '\n')
-                open("%s/import/%s_not_imported%s.csv" % (i_home,filename,current),"a").write('%s,"Error"' %s + '\n')
                 format = ','.join(['"%%(%s)s"' % fn for fn in import_keys])
                 format_error = format + ',"%(Error)s"'
-                #from pdb import set_trace; set_trace()
                 format = '"%(id)s",'+ format
             ds = DataStructure(data=item,datamodel=dm)
@@ -822,5 +828,5 @@
             if not error_string:
                 item.update(dm)
-                item['id'],error = creator(item)
+                item['id'],error = importer(item)
                 if error:
                     error_string += error
@@ -840,5 +846,5 @@
                 if len(imported) > 0:
                     open("%s/import/%s_imported%s.csv" % (i_home,filename,current),"a").write(
-                             '\n'.join(not_imported) + '\n')
+                             '\n'.join(imported) + '\n')
                     imported = []
                 em = '%d transactions committed\n' % (tr_count)
Index: /WAeUP_SRP/trunk/Widgets.py
===================================================================
--- /WAeUP_SRP/trunk/Widgets.py	(revision 1771)
+++ /WAeUP_SRP/trunk/Widgets.py	(revision 1772)
@@ -6,5 +6,5 @@
 ##from Products.CPSSchemas.Widget import CPSWidgetType
 from Products.CMFCore.utils import getToolByName
-from Products.CPSSchemas.BasicWidgets import CPSWidget, CPSStringWidget, CPSEmailWidget,CPSImageWidget
+from Products.CPSSchemas.BasicWidgets import CPSBooleanWidget, CPSWidget, CPSStringWidget, CPSEmailWidget,CPSImageWidget
 from Products.CPSSchemas.BasicWidgets import renderHtmlTag,CPSSelectWidget, CPSStringWidget
 from Products.CPSSchemas.ExtendedWidgets import CPSDateTimeWidget
@@ -389,4 +389,33 @@
 widgetRegistry.register(SecretWidget)
 ###)
+
+class WAeUPSexWidget(CPSBooleanWidget):
+    """WAeUP sex widget."""
+    meta_type = 'WAeUP Sex Widget'
+
+    def validate(self, datastructure, **kw):
+        """Validate datastructure and update datamodel."""
+        value = datastructure[self.getWidgetId()]
+
+        if self.render_format not in self.render_formats:
+            self.render_format = 'select'
+
+        female = value in ('F','f','Female','female',"True",True)
+        male = value in ('M','m','Male','male','False',False)
+        if not female and not male:
+            datastructure.setError(self.getWidgetId(),
+                                   "invalid sex %s" % value)
+            return 0
+        elif female:
+            v = True
+        else:
+            v = False
+        datamodel = datastructure.getDataModel()
+        datamodel[self.fields[0]] = v
+        return 1
+
+InitializeClass(WAeUPSexWidget)
+
+widgetRegistry.register(WAeUPSexWidget)
 
 class MatricNoWidget(CPSStringWidget): ###(
Index: /WAeUP_SRP/trunk/profiles/default/layouts/import_student.xml
===================================================================
--- /WAeUP_SRP/trunk/profiles/default/layouts/import_student.xml	(revision 1771)
+++ /WAeUP_SRP/trunk/profiles/default/layouts/import_student.xml	(revision 1772)
@@ -216,5 +216,5 @@
   <property name="display_width">10</property>
  </widget>
- <widget name="sex" meta_type="Boolean Widget">
+ <widget name="sex" meta_type="WAeUP Sex Widget">
   <property name="title">Sex</property>
   <property name="fields">
