Index: WAeUP_SRP/branches/joachim-azax-branch/skins/waeup_academics/academicsParent.py
===================================================================
--- WAeUP_SRP/branches/joachim-azax-branch/skins/waeup_academics/academicsParent.py	(revision 1979)
+++ WAeUP_SRP/branches/joachim-azax-branch/skins/waeup_academics/academicsParent.py	(revision 1988)
@@ -12,4 +12,5 @@
     obj=context
 
+
 parent=obj.aq_parent
 
Index: WAeUP_SRP/branches/joachim-azax-branch/skins/waeup_academics/academics_index.py
===================================================================
--- WAeUP_SRP/branches/joachim-azax-branch/skins/waeup_academics/academics_index.py	(revision 1979)
+++ WAeUP_SRP/branches/joachim-azax-branch/skins/waeup_academics/academics_index.py	(revision 1988)
@@ -12,4 +12,9 @@
 return the appropriate page in the academics section
 """
+try:
+    from Products.zdb import set_trace
+except:
+    def set_trace():
+        pass
 
 request = context.REQUEST
Index: WAeUP_SRP/branches/joachim-azax-branch/skins/waeup_academics/getCertificatesInfo.py
===================================================================
--- WAeUP_SRP/branches/joachim-azax-branch/skins/waeup_academics/getCertificatesInfo.py	(revision 1979)
+++ WAeUP_SRP/branches/joachim-azax-branch/skins/waeup_academics/getCertificatesInfo.py	(revision 1988)
@@ -12,4 +12,9 @@
 return Info about the Faculties
 """
+try:
+    from Products.zdb import set_trace
+except:
+    def set_trace():
+        pass
 request = context.REQUEST
 
@@ -19,15 +24,16 @@
 
 info = {}
-#dep_id = request.get('PATH_TRANSLATED').split('/')[-2]
-dep_id = context.aq_parent.getId()
+dep_id = path_info[-2]
+#set_trace()
 info['action'] = "%s" % context.absolute_url()
 info['choosen_ids'] = request.get('ids',[])
 info['doc'] = context.getContent()
-res = context.portal_catalog(meta_type="Department",id = dep_id)
+#res = context.portal_catalog(meta_type="Department",id = dep_id)
 info['courses'] = []
-if not res:
-    return info
-brain = res[-1]
-cp = brain.getPath()
+# if not res:
+#     return info
+# brain = res[-1]
+# cp = brain.getPath()
+cp = '/'.join(path_info[:-2])
 info['container_path'] = cp
 info['dep_id'] = dep_id
Index: WAeUP_SRP/branches/joachim-azax-branch/skins/waeup_academics/getCoursesCertificatesInfo.py
===================================================================
--- WAeUP_SRP/branches/joachim-azax-branch/skins/waeup_academics/getCoursesCertificatesInfo.py	(revision 1979)
+++ WAeUP_SRP/branches/joachim-azax-branch/skins/waeup_academics/getCoursesCertificatesInfo.py	(revision 1988)
@@ -15,5 +15,4 @@
 
 wf = context.portal_workflow
-path_info = request.get('PATH_INFO').split('/')
 
 info = {}
@@ -21,18 +20,8 @@
 info['choosen_ids'] = request.get('ids',[])
 info['doc'] = context.getContent()
-brain = context.portal_catalog(meta_type="Department", id = context.getId())[-1]
-cp = brain.getPath()
+# brain = context.portal_catalog(meta_type="Department", id = context.getId())[-1]
+# cp = brain.getPath()
+cp = request.get('PATH_INFO')
 info['container_path'] = cp
-#res = context.portal_catalog(container_path="%s/courses" % cp)
-#items = []
-#for r in res:
-#    row = {}
-#    ro = r.getObject()
-#    rd = ro.getContent()
-#    row['id'] = r.getId
-#    row['title'] = rd.Title()
-#    row['url'] = ro.absolute_url()
-#    items.append(row)
-#info['courses'] = items
 res = context.portal_catalog(container_path="%s/certificates" % cp)
 items = []
Index: WAeUP_SRP/branches/joachim-azax-branch/skins/waeup_academics/getCoursesInfo.py
===================================================================
--- WAeUP_SRP/branches/joachim-azax-branch/skins/waeup_academics/getCoursesInfo.py	(revision 1979)
+++ WAeUP_SRP/branches/joachim-azax-branch/skins/waeup_academics/getCoursesInfo.py	(revision 1988)
@@ -28,15 +28,16 @@
 
 info = {}
-#dep_id = request.get('PATH_TRANSLATED').split('/')[-2]
-dep_id = context.aq_parent.getId()
+dep_id = path_info[-2]
+#dep_id = context.aq_parent.getId()
 info['action'] = "%s" % context.absolute_url()
 info['choosen_ids'] = request.get('ids',[])
 info['doc'] = context.getContent()
-res = context.portal_catalog(meta_type="Department",id = dep_id)
-info['courses'] = []
-if not res:
-    return info
-brain = res[-1]
-cp = brain.getPath()
+# res = context.portal_catalog(meta_type="Department",id = dep_id)
+# info['courses'] = []
+# if not res:
+#     return info
+# brain = res[-1]
+# cp = brain.getPath()
+cp = '/'.join(path_info[:-2])
 info['container_path'] = cp
 info['dep_id'] = dep_id
Index: WAeUP_SRP/branches/joachim-azax-branch/skins/waeup_academics/getDepartmentsInfo.py
===================================================================
--- WAeUP_SRP/branches/joachim-azax-branch/skins/waeup_academics/getDepartmentsInfo.py	(revision 1979)
+++ WAeUP_SRP/branches/joachim-azax-branch/skins/waeup_academics/getDepartmentsInfo.py	(revision 1988)
@@ -12,4 +12,9 @@
 return Info about the Faculties
 """
+try:
+    from Products.zdb import set_trace
+except:
+    def set_trace():
+        pass
 request = context.REQUEST
 
@@ -17,5 +22,5 @@
 mtool = context.portal_membership
 member = mtool.getAuthenticatedMember()
-path_info = request.get('PATH_INFO').split('/')
+#path_info = request.get('PATH_INFO').split('/')
 
 info = {}
@@ -26,6 +31,8 @@
 items = []
 info['doc'] = context.getContent()
-brain = context.portal_catalog(meta_type="Faculty", id = context.getId())[-1]
-cp = brain.getPath()
+# set_trace()
+# brain = context.portal_catalog(portal_type="Faculty", id = context.getId())[-1]
+# cp = brain.getPath()
+cp = request.get('PATH_INFO')
 info['container_path'] = cp
 res = context.portal_catalog(container_path=cp)
Index: WAeUP_SRP/branches/joachim-azax-branch/skins/waeup_academics/getDocumentInfo.py
===================================================================
--- WAeUP_SRP/branches/joachim-azax-branch/skins/waeup_academics/getDocumentInfo.py	(revision 1979)
+++ WAeUP_SRP/branches/joachim-azax-branch/skins/waeup_academics/getDocumentInfo.py	(revision 1988)
@@ -10,10 +10,6 @@
 # $Id:getDocumentInfo.py 486 2006-09-06 10:09:39Z joachim $
 """
-return Info about the Faculties
+return Info about the Documents
 """
-request = context.REQUEST
-
-wf = context.portal_workflow
-path_info = request.get('PATH_INFO').split('/')
 
 info = {}
Index: WAeUP_SRP/branches/joachim-azax-branch/skins/waeup_default/sessions_voc.py
===================================================================
--- WAeUP_SRP/branches/joachim-azax-branch/skins/waeup_default/sessions_voc.py	(revision 1979)
+++ WAeUP_SRP/branches/joachim-azax-branch/skins/waeup_default/sessions_voc.py	(revision 1988)
@@ -6,5 +6,6 @@
 """
 if key is None:
-    l = [('xx','unknown')]
+    # not used for WAeUPSessionWidget, only for SelectWidget
+    l = [('-1','N/A')]
     for y in range(1998,2008):
         l.append( ('%s' % str(y)[-2:],'%4d/%4d' % (y,y+1)))
@@ -14,5 +15,7 @@
     y = int(key)
 except:
-    return 'unknown'
+    return 'N/A'
+if y == -1:
+    return 'N/A' 
 if y < 90:
     cent = 2000
Index: WAeUP_SRP/branches/joachim-azax-branch/skins/waeup_default/waeup_edit.py
===================================================================
--- WAeUP_SRP/branches/joachim-azax-branch/skins/waeup_default/waeup_edit.py	(revision 1979)
+++ WAeUP_SRP/branches/joachim-azax-branch/skins/waeup_default/waeup_edit.py	(revision 1988)
@@ -19,4 +19,9 @@
 import logging
 logger = logging.getLogger('Skins.waeup_edit')
+try:
+    from Products.zdb import set_trace
+except:
+    def set_trace():
+        pass
 
 mtool = context.portal_membership
Index: WAeUP_SRP/branches/joachim-azax-branch/skins/waeup_design/main_template.pt
===================================================================
--- WAeUP_SRP/branches/joachim-azax-branch/skins/waeup_design/main_template.pt	(revision 1979)
+++ WAeUP_SRP/branches/joachim-azax-branch/skins/waeup_design/main_template.pt	(revision 1988)
@@ -3,5 +3,4 @@
   emptybody emptybody|request/emptybody|nothing;
   mtool here/portal_membership;
-  
   utool nocall:here/portal_url;
   atool here/portal_actions;
@@ -39,5 +38,5 @@
           <metal:block define-slot="base">
             <base href=""
-                  tal:attributes="href string:${here_url}/" />
+                  tal:attributes="href string:${context/get_proxy_url}" />
           </metal:block>
         </metal:block>
Index: WAeUP_SRP/branches/joachim-azax-branch/skins/waeup_student/create_level.py
===================================================================
--- WAeUP_SRP/branches/joachim-azax-branch/skins/waeup_student/create_level.py	(revision 1979)
+++ WAeUP_SRP/branches/joachim-azax-branch/skins/waeup_student/create_level.py	(revision 1988)
@@ -34,5 +34,5 @@
 current_level = student.level
 in_progress =  request.get('in_progress','not started')
-level_created =  request.get('level_created','xxx')
+#level_created =  request.get('level_created','xxx')
 create_level =  request.get('create_level',None)
 
@@ -71,5 +71,5 @@
     l = []
     carry_overs = results
-    
+
     # carry_overs for probation students: yes or not, that is the question
     #if student.verdict == "C": # on probation
Index: WAeUP_SRP/branches/joachim-azax-branch/skins/waeup_student/external_study_level_view.pt
===================================================================
--- WAeUP_SRP/branches/joachim-azax-branch/skins/waeup_student/external_study_level_view.pt	(revision 1979)
+++ WAeUP_SRP/branches/joachim-azax-branch/skins/waeup_student/external_study_level_view.pt	(revision 1988)
@@ -1,22 +1,27 @@
-<metal:html>
-  <metal:body use-macro="here/slip_template/macros/master">
-    <metal:block fill-slot="header" 
-                 tal:define="global info context/getStudyLevelInfo;
-                 global is_so context/isSectionOfficer;
-                 global is_ca info/is_ca;
-                 global show_check_boxes info/show_check_boxes;
-		             global is_student info/is_student;
-		             global status_info info/status_info;
-		             global review_state info/review_state;
-		             global view_only info/view_only">
-              <div style="text-align: right"
-             tal:condition="python:review_state == 'courses_validated'">
-        <a href="" target="slip" tal:attributes="href string:course_registration_slip"
-            onclick="javascript:window.open('','slip','width=600, height=700, directories=no, toolbar=no, location=no, menubar=yes, scrollbars=yes, status=no, resizable=no, dependent=no')">
-            <img tal:attributes="src string:${here/portal_url}/actionicon_print.png" />
-            Course Registration Slip
-        </a>
-        
-        </div>
+<metal:body use-macro="here/slip_template/macros/master">
+  <metal:main fill-slot="main"
+          tal:define="info context/getStudyLevelInfo;">
+             
+    <span tal:condition="not: info">
+      <span tal:content="here/illegal_view" />
+    </span>
+    <span tal:condition="info">
+    <span tal:define= "is_so context/isSectionOfficer;
+                       is_ca info/is_ca;
+                       show_check_boxes info/show_check_boxes;
+                       is_student info/is_student;
+                       status_info info/status_info;
+                       review_state info/review_state;
+                       view_only info/view_only">       
+
+    <div style="text-align: right" 
+         tal:condition="python:review_state in ('courses_registered','courses_validated',)">
+    <a href="" target="slip" tal:attributes="href string:course_registration_slip"
+        onclick="javascript:window.open('','slip','width=600, height=700, directories=no, toolbar=no, location=no, menubar=yes, scrollbars=yes, status=no, resizable=no, dependent=no')">
+        <img tal:attributes="src string:${here/portal_url}/actionicon_print.png" />
+        Course Registration Slip
+    </a>
+    </div>
+
 
       <h3> 
@@ -27,6 +32,4 @@
       </h3>
 
-    </metal:block>
-    <metal:main fill-slot="main" tal:condition="python:1">
       <form action="." method="post" class="group">
         <span tal:condition="info/carry_overs" tal:omit-tag="">
@@ -46,8 +49,8 @@
             </td>
             <td width="78%" tal:content="row/title"></td>
-            <td align="center" width="10%" tal:content="row/code"></td>
-            <td align="center" width="2%">S<span tal:content="row/semester" /></td>
-            <td align="center" width="2%" tal:content="row/credits"></td>
-            <td align="center" width="8%" tal:content="row/grade|string:"></td>
+            <td width="10%" tal:content="row/code"></td>
+            <td width="2%">S<span tal:content="row/semester" /></td>
+            <td width="2%" tal:content="row/credits"></td>
+            <td width="8%" tal:content="row/grade|string:"></td>
           </tr>
         </table>
@@ -73,8 +76,8 @@
             </td>
             <td width="78%" tal:content="row/title"></td>
-            <td align="center" width="10%" tal:content="row/code"></td>
-            <td align="center" width="2%">S<span tal:content="row/semester" /></td>
-            <td align="center" width="2%" tal:content="row/credits"></td>
-            <td align="center" width="8%" tal:content="row/coe|nothing"></td>
+            <td width="10%" tal:content="row/code"></td>
+            <td width="2%">S<span tal:content="row/semester" /></td>
+            <td width="2%" tal:content="row/credits"></td>
+            <td width="8%" tal:content="row/coe|nothing"></td>
           </tr>
           <tr>
@@ -196,6 +199,7 @@
         </table>
         </form>         
-    </metal:main>
-  </metal:body>
-</metal:html>
+  </span>
+  </span>          
+  </metal:main>
+</metal:body>
   
Index: WAeUP_SRP/branches/joachim-azax-branch/skins/waeup_student/layout_clearance_view.pt
===================================================================
--- WAeUP_SRP/branches/joachim-azax-branch/skins/waeup_student/layout_clearance_view.pt	(revision 1979)
+++ WAeUP_SRP/branches/joachim-azax-branch/skins/waeup_student/layout_clearance_view.pt	(revision 1988)
@@ -22,5 +22,5 @@
             <tr>                         
             <tal:block condition="widget/label">
-            <td width="180px">
+            <td width="180px" valign="top">
               <span i18n:translate="" tal:condition="widget/is_i18n">
                   <span tal:content="widget/label" />:</span>
Index: WAeUP_SRP/branches/joachim-azax-branch/skins/waeup_student/student_view.pt
===================================================================
--- WAeUP_SRP/branches/joachim-azax-branch/skins/waeup_student/student_view.pt	(revision 1979)
+++ WAeUP_SRP/branches/joachim-azax-branch/skins/waeup_student/student_view.pt	(revision 1988)
@@ -1,5 +1,6 @@
 <metal:body use-macro="here/main_template/macros/master">
     <metal:main fill-slot="main" 
-           tal:define="info context/getStudentFolderInfo;">
+           tal:define="info context/getStudentFolderInfo;
+                       baseinfo context/getStudentBaseInfo">
       <metal:block tal:condition="not: info">
         <span tal:content="here/illegal_view" />
@@ -19,89 +20,134 @@
         <h3 tal:content="info/name" />
         <br />
-
-        <table tal:condition="is_staff" class="contentListing" width="100%" summary="content layout" id="folder_content">      
-          <tr tal:repeat="row rows"
-            tal:attributes="class python:test(repeat['row'].even(), 'even ajaxtd', 'odd ajaxtd')">
-            <td><a href="view" tal:attributes="href string:${row/url}">
-              <strong tal:content="row/title" /></a> </td>
-            <td> 
-            <a tal:condition="python: row['is_editable'] and not row['type'] in ('StudentClearance','StudentAccommodation',)"
-                href="edit" tal:attributes="href string:${row/url}/external_edit_form"
-                target="edit"
-                onclick="javascript:window.open('','edit','width=600, height=700, directories=no, toolbar=no, location=no, menubar=no, scrollbars=yes, status=no, resizable=no, dependent=no')">
-                [edit]
-            </a> 
-            <a tal:condition="python: row['is_editable'] and row['type']=='StudentClearance'"
-                href="edit" tal:attributes="href string:${row/url}/external_clearance_edit_form"
-                target="edit"
-                onclick="javascript:window.open('','edit','width=600, height=700, directories=no, toolbar=no, location=no, menubar=no, scrollbars=yes, status=no, resizable=no, dependent=no')">
-                [edit and change state]
-            </a>  
-            <a tal:condition="python: context.isClearanceOfficer() and row['type']=='StudentClearance'"
-                href="edit" tal:attributes="href string:${row/url}/external_clearance_edit_form"
-                target="edit"
-                onclick="javascript:window.open('','edit','width=600, height=700, directories=no, toolbar=no, location=no, menubar=no, scrollbars=yes, status=no, resizable=no, dependent=no')">
-                [change state]
-            </a>                            
-            </td>
-            
-          </tr>
-          <tr tal:condition="info/session">
-            <td>
-                <a href="edit" tal:attributes="href string:session_results_view">
-                <strong>Session Results</strong>
-            </a>             
-            </td>
-            <td>
-               &nbsp;
-            </td>
-          </tr>
-        </table>
         
-                  
-         <span tal:condition="python:info['member'].id in 
-                             ('admin','joachim','kehindesamuel','med','isouaba','obadejo',
-                              'ehioaiks','despej','shinakale','igadoghe','benamechi','edafeohwo')">
-         <br />
-         <form action="mail_password_form" method="post" class="group">
-            <input type="submit" class="context" value="Send Email with Authentication Data" />
-         </form>
-         </span> 
+        
+        
+      <table>
+        <tr>
+          <td width="220px">Registration Number:</td> 
+          <td><span tal:content="baseinfo/student/jamb_reg_no" /></td>
+        </tr>
+        <tr>
+          <td>Matriculation Number:</td> 
+          <td><span tal:content="baseinfo/student/matric_no" /></td>
+        </tr>      
+        <tr>
+          <td>Certificate Code:</td> 
+          <td><span tal:content="baseinfo/student/course" /></td>
+        </tr>
+        <tr>
+          <td>Faculty Id:</td>
+          <td tal:content="baseinfo/student/faculty" />
+        </tr>
+        <tr>
+          <td>Department Id:</td> 
+          <td><span tal:content="baseinfo/student/department" /></td>
+        </tr>
+        <tr>
+          <td>Current Session:</td> 
+          <td><span tal:content="python:context.portal_vocabularies.sessions.get(baseinfo['student']['session'])" /></td>
+        </tr>
+        <tr>
+          <td>Current Study Level:</td> 
+          <td><span tal:content="python:context.portal_vocabularies.courselevel.get(baseinfo['student']['level'])" /></td>
+        </tr>
+        <tr>
+          <td>Current Study Mode:</td> 
+          <td><span tal:content="python:context.portal_vocabularies.entry_modes.get(baseinfo['student']['mode'])" /></td>
+        </tr>        
+        <tr tal:define="verdict python:context.portal_vocabularies.verdicts.get(baseinfo['student']['verdict'])">
+          <td>Current Verdict:</td> 
+          <td><span tal:condition="verdict" tal:content="python:verdict.upper()" /></td>
+        </tr>
+      </table>           
+        
+      <br />
+      
+      <table tal:condition="is_staff" class="contentListing" width="100%" summary="content layout" id="folder_content">      
+        <tr tal:repeat="row rows"
+          tal:attributes="class python:test(repeat['row'].even(), 'even ajaxtd', 'odd ajaxtd')">
+          <td><a href="view" tal:attributes="href string:${row/url}">
+            <strong tal:content="row/title" /></a> </td>
+          <td> 
+          <a tal:condition="python: row['is_editable'] and not row['type'] in ('StudentClearance','StudentAccommodation','PaymentsFolder')"
+              href="edit" tal:attributes="href string:${row/url}/external_edit_form"
+              target="edit"
+              onclick="javascript:window.open('','edit','width=600, height=700, directories=no, toolbar=no, location=no, menubar=no, scrollbars=yes, status=no, resizable=no, dependent=no')">
+              [edit]
+          </a> 
+          <a tal:condition="python: row['is_editable'] and row['type']=='StudentClearance'"
+              href="edit" tal:attributes="href string:${row/url}/external_clearance_edit_form"
+              target="edit"
+              onclick="javascript:window.open('','edit','width=600, height=700, directories=no, toolbar=no, location=no, menubar=no, scrollbars=yes, status=no, resizable=no, dependent=no')">
+              [edit and change state]
+          </a>  
+          <a tal:condition="python: context.isClearanceOfficer() and row['type']=='StudentClearance'"
+              href="edit" tal:attributes="href string:${row/url}/external_clearance_edit_form"
+              target="edit"
+              onclick="javascript:window.open('','edit','width=600, height=700, directories=no, toolbar=no, location=no, menubar=no, scrollbars=yes, status=no, resizable=no, dependent=no')">
+              [change state]
+          </a>                            
+          </td>
+          
+        </tr>
+        <tr tal:condition="info/session">
+          <td>
+              <a href="edit" tal:attributes="href string:session_results_view">
+              <strong>Session Results</strong>
+          </a>             
+          </td>
+          <td>
+             &nbsp;
+          </td>
+        </tr>
+      </table>
+      
+                
+      <span tal:condition="python:info['member'].id in 
+                         ('admin','joachim','kehindesamuel','med','isouaba','obadejo',
+                          'ehioaiks','despej','shinakale','igadoghe','benamechi','edafeohwo')">
+      <br />
+      <form action="mail_password_form" method="post" class="group">
+         <input type="submit" class="context" value="Send Email with Authentication Data" />
+      </form>
+      </span> 
 
 
-        
+      
 
-    <table tal:condition="is_student" class="contentListing" width="" summary="content layout" id="folder_content">      
-      <span tal:repeat="row rows">
-        <tr tal:condition="row/display">
-          <td><a href="view" tal:condition="row/s_view_link"
-                 tal:attributes="href string:${row/s_view_link}">
-              <strong tal:content="row/title" /></a>
-           <strong tal:condition="not:row/s_view_link" tal:content="row/title" />
+      <table tal:condition="is_student" class="contentListing" width="" summary="content layout" id="folder_content">      
+        <span tal:repeat="row rows">
+          <tr tal:condition="row/display">
+            <td width="220px"><a href="view" tal:condition="row/s_view_link"
+                   tal:attributes="href string:${row/s_view_link}">
+                <strong tal:content="row/title" /></a>
+             <strong tal:condition="not:row/s_view_link" tal:content="row/title" />
+            </td>
+  
+            <td align="left"> 
+                <span tal:content="row/review_state" />
+            </td>          
+            
+            <td width="40px" align="center"> 
+              <a tal:condition="python: row['s_edit_link'] and row['is_editable']"
+                 href="edit" tal:attributes="href string:${row/s_edit_link}">
+                [edit]
+              </a>     
+            </td>                 
+            
+  
+          </tr>
+        </span>
+        <tr tal:condition="info/session">
+          <td>
+              <a href="edit" tal:attributes="href string:session_results_view">
+              <strong>Session Results</strong>
+          </a>             
           </td>
-
-          <td width="80px" align="center"> 
-            <a tal:condition="python: row['s_edit_link'] and row['is_editable']"
-               href="edit" tal:attributes="href string:${row/s_edit_link}">
-              [edit]
-            </a>     
-          </td>                 
-          
-          <td width="100px" align="left"> 
-              <span tal:content="row/review_state" />
+          <td>
+             &nbsp;
           </td>
         </tr>
-      </span>
-      <tr tal:condition="info/session">
-        <td>
-            <a href="edit" tal:attributes="href string:session_results_view">
-            <strong>Session Results</strong>
-        </a>             
-        </td>
-        <td>
-           &nbsp;
-        </td>
-      </tr>
-    </table>
+      </table>
         
     </metal:block>
Index: WAeUP_SRP/branches/joachim-azax-branch/skins/waeup_utilities/ti_294_resolve.py
===================================================================
--- WAeUP_SRP/branches/joachim-azax-branch/skins/waeup_utilities/ti_294_resolve.py	(revision 1988)
+++ WAeUP_SRP/branches/joachim-azax-branch/skins/waeup_utilities/ti_294_resolve.py	(revision 1988)
@@ -0,0 +1,77 @@
+## Script (Python) "findStudentsWithCourses"
+##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
+import logging
+logger = logging.getLogger('Skins.ti_294_resolve')
+from Products.AdvancedQuery import Eq, Between, Le,In
+aq_students = context.students_catalog.evalAdvancedQuery
+
+request = context.REQUEST
+session = request.SESSION
+response = request.RESPONSE
+setheader = request.RESPONSE.setHeader
+students = context.portal_url.getPortalObject().campus.students
+#from string import Template
+def rwrite(s):
+    response.setHeader('Content-type','text/html; charset=ISO-8859-15')
+    response.write("%s<br>\n\r" % s)
+
+#logger.info('')
+
+query = In('registered_courses',('',))
+brains = aq_students(query)
+total = len(brains)
+logger.info('found %d students with empty course_result id' % total)
+count = 0
+commit_after = 5000
+todelete = []
+for brain in brains:
+    level_object = None
+    #
+    #set_trace()
+    try:
+        level_object = getattr(getattr(getattr(students,brain.id),'study_course'),brain.level)
+    except:
+        continue
+    ids = level_object.objectIds()
+    logger.info('ids of %s: %s#%s' % (brain.id,list(ids),brain.registered_courses))
+    if '' in ids:
+        todelete.append((brain.id,level_object))
+        rwrite("appended %s" % (brain.id))
+    else:
+        registered_courses = brain.registered_courses
+        registered_courses.remove('')
+        logger.info('object not found, %s' % registered_courses)
+        # the following line is critical (modifying the catalog in a for brain in brains loop)
+        context.students_catalog.modifyRecord(id=brain.id,registered_courses=registered_courses)
+logger.info('todelete %d' % (len(todelete)))
+for brain_id,level_object in todelete:
+    count += 1
+    #set_trace()
+    try:
+        level_object.manage_delObjects(['',])
+        logger.info('deleted course with empty id of %s' % (brain_id))
+        rwrite("%d: deleted empty id in %s" % (count, level_object.absolute_url()))
+    except:
+        logger.info('could not delete course with empty in of %s' % (level_object.absolute_url()))
+        rwrite("%d: could not delete empty id in %s" % (count, level_object.absolute_url()))
+    if count and not count % commit_after:
+        context.waeup_tool.doCommit()
+        logger.info("committed %d transactions" % commit_after)
+logger.info('finished for %d of %d' % (count,total))
+return
+
