Index: /WAeUP_SRP/base/skins/cps_custom/logged_in.py
===================================================================
--- /WAeUP_SRP/base/skins/cps_custom/logged_in.py	(revision 2411)
+++ /WAeUP_SRP/base/skins/cps_custom/logged_in.py	(revision 2412)
@@ -45,10 +45,10 @@
         student_app = getattr(student,'application',None)
         student_per = getattr(student,'personal',None)
-        
-        #########################################################
-        
+
+        #########################################################
+
         # perform makeStudentData for returning students who login for the first time
         # the returning key comes from set_access_data
-              
+
         if request.has_key('returning') and  student_app is None:
             email=request.get("email")
@@ -65,10 +65,13 @@
         elif student_app is None:
             context.waeup_tool.makeStudentData(str(member))
+            
+        #########################################################
+
         student_app = getattr(student,'application',None)
-        
-        #########################################################
-        
-        # add missing payments folders
-        
+
+        #########################################################
+
+        # add missing payments folder
+
         if 'payments' not in student.objectIds():
             student.invokeFactory('PaymentsFolder','payments')
@@ -78,7 +81,7 @@
             d['Title'] = 'Online Payments'
             payments.getContent().edit(mapping=d)
-            
-        #########################################################            
-            
+
+        #########################################################
+
         #student_pume = getattr(student,'pume',None)
         s_review_state = context.getStudentReviewState(student.id)
@@ -90,5 +93,5 @@
 
         #########################################################
-        
+
         # save email and phone of returning students after all objects have been created
 
@@ -106,7 +109,7 @@
             per_doc.edit(mapping = {'email' : email, 'phone' : phone})
             wftool.doActionFor(student_app,'close')
-            
-        #########################################################     
-        
+
+        #########################################################
+
         # look for passport pictures of returning students
 
@@ -120,5 +123,5 @@
 
         #########################################################
-        
+
         # look for passport pictures of new students
 
@@ -131,9 +134,9 @@
 
         #########################################################
-        
+
         # perform necessary updates for new students
 
         # 1. add pin and application date to app_doc
-        
+
         if s_review_state in ("student_created","admitted") and\
                              a_review_state == 'created' :
@@ -143,6 +146,6 @@
             da = {}
             pin = request.get('pin')
-            
-            # if the student comes directly, add missing pin (fix)
+
+            # if the student comes directly, add missing pin or pin with wrong syntax (fix)
             if not pin:
                 jamb_reg_no = app_doc.jamb_reg_no
@@ -160,7 +163,8 @@
             da['app_ac_date'] = current
             app_doc.edit(mapping = da)
-            
-        # 2. same as 1 but without opening app_doc    
-            
+
+        # 2. same as 1 but without opening app_doc, assuming that the student already logged in
+        #    but the pin is missing in app_doc (fix)
+
         elif s_review_state in ("admitted") and a_review_state == 'opened' and\
                                             not app_doc.app_ac_pin:
@@ -179,13 +183,13 @@
                 da['app_ac_pin'] = pin
                 app_doc.edit(mapping = da)
-                
-        # 2. open personal object. This should be done in clearance_edit.       
-                
+
+        # 3. open personal object (fix). This should be done in clearance_edit.
+
         elif s_review_state in ("cleared_and_validated",) and\
                              p_review_state == 'created' :
             wftool.doActionFor(student_per,'open')
-            
-        #########################################################
-            
+
+        #########################################################
+
         res = context.students_catalog(id = str(member))
         matric_no = res[0].matric_no
@@ -193,5 +197,5 @@
 
         #########################################################
-        
+
         # fetch current verdict via getVerdict
 
@@ -208,11 +212,11 @@
                 study_course_doc.edit(mapping = dsc)
                 wftool.doActionFor(study_course,'close_for_edit')
-                
-        #########################################################
-                
+
+        #########################################################
+
         has_results = context.results_import(matric_no = matric_no)
 
         #########################################################
-        
+
         # determine appropriate redirect url
 
