Index: /WAeUP_SRP/base/skins/waeup_student/search_students.py
===================================================================
--- /WAeUP_SRP/base/skins/waeup_student/search_students.py	(revision 3065)
+++ /WAeUP_SRP/base/skins/waeup_student/search_students.py	(revision 3066)
@@ -58,73 +58,48 @@
 co_view = False
 ca_view = False
-faculties =  fget('faculties')
-departments = fget('departments')
-certificate_levels = fget('certificate_levels')
-dep_str = fac_str = certificate_levels_str = ''
-
+session_data = request.SESSION
+faculties =  session_data.get('faculties',None)
+departments = session_data.get('departments',None)
+certificate_levels = session_data.get('certificate_levels',None)
 # determine local roles
-
 if "ClearanceOfficers" in member.getGroups():
     default_state = "clearance_requested"
     co_view = True
-    if faculties or departments:
-        #from Products.zdb import set_trace;set_trace()
-        if faculties:
-            fac_str = faculties
-            faculties = faculties.split()
-        if departments:
-            dep_str = departments
-            departments = departments.split()
-    else:
-        query = In('portal_type',('Faculty',)) &\
+    if faculties is None or departments is None:
+        logger.info('ClearanceOfficer %s initiated student_search' % member)
+        query = In('portal_type',('Faculty','Department')) &\
                  In('localUsersWithRoles', ("user:%s" % member,))
         res = aq_portal(query)
-        logger.info('ClearanceOfficer %s initiated student_search' % member)
-        faculties = []
-        if res:
-            faculties = [f.getId for f in res]
-        user_info['faculties'] = faculties
-        fac_str = " ".join(faculties)
-        query = In('portal_type',('Department',)) &\
-                 In('localUsersWithRoles', ("user:%s" % member,))
-        res = aq_portal(query)
-        departments = []
-        if res:
-            departments = [f.getId for f in res]
-        user_info['departments'] = departments
-        dep_str = " ".join(departments)
+        faculties = [f.getId for f in res if f.portal_type == 'Faculty']
+        departments = [f.getId for f in res if f.portal_type == 'Department']
+    user_info['faculties'] = session_data['faculties'] = faculties
+    user_info['departments'] = session_data['departments'] =  departments
 elif "CourseAdvisers" in member.getGroups():
     default_state = "courses_registered"
     ca_view = True
-    if certificate_levels:
-        certificate_levels_str = certificate_levels
-        certificate_levels = certificate_levels.split()
-    else:
+    if certificate_levels is None:
+        logger.info('CourseAdviser %s initiated student_search' % member)
         query = In('portal_type',('StudyLevel',)) &\
                  In('localUsersWithRoles', ("user:%s" % member,))
         res = aq_portal(query)
-        logger.info('CourseAdviser %s initiated student_search' % member)
-        certificate_levels = []
-        if res:
-            certificate_levels = ['/'.join(f.getPath().split('/')[-2:]) for f in res]
-            cert_ids = []
-            level_ids = []
-            for cl in certificate_levels:
-                c,l = cl.split('/')
-                level_ids += l,
-                if c not in cert_ids:
-                    cert_ids += c,
-            cert_brains = aq_portal(In("id",cert_ids))
-            end_levels = {}
-            for cert_brain in cert_brains:
-                end_levels[cert_brain.getId] = cert_brain.getObject().getContent().end_level
-            for cl in certificate_levels[:]:
-                c,l = cl.split('/')
-                for prob in (10,20):
-                    certificate_levels += "%s/%s" % (c,int(l) + prob),
-                if l == end_levels[c]:
-                    certificate_levels += "%s/%s" % (c,int(l) + 100),
-        user_info['certificate_levels'] = certificate_levels
-        certificate_levels_str = " ".join(certificate_levels)
+        certificate_levels = ['/'.join(f.getPath().split('/')[-2:]) for f in res]
+        cert_ids = []
+        level_ids = []
+        for cl in certificate_levels:
+            c,l = cl.split('/')
+            level_ids += l,
+            if c not in cert_ids:
+                cert_ids += c,
+        cert_brains = aq_portal(In("id",cert_ids))
+        end_levels = {}
+        for cert_brain in cert_brains:
+            end_levels[cert_brain.getId] = cert_brain.getObject().getContent().end_level
+        for cl in certificate_levels[:]:
+            c,l = cl.split('/')
+            for prob in (10,20):
+                certificate_levels += "%s/%s" % (c,int(l) + prob),
+            if l == end_levels[c]:
+                certificate_levels += "%s/%s" % (c,int(l) + 100),
+    user_info['certificate_levels'] = session_data['certificate_levels'] = certificate_levels
 
 default = {'search_mode': 'student_id',
@@ -139,7 +114,4 @@
                       layout_mode='edit',
                       formaction="search_students",
-                      faculties = fac_str,
-                      departments = dep_str,
-                      certificate_levels = certificate_levels_str,
                       commit = False,
                       )
