Ignore:
Timestamp:
16 Dec 2006, 15:53:13 (18 years ago)
Author:
joachim
Message:

speed improvements for waeup_edit and portlet_session_info

Location:
WAeUP_SRP/trunk/skins/waeup_student
Files:
2 added
5 edited

Legend:

Unmodified
Added
Removed
  • WAeUP_SRP/trunk/skins/waeup_student/application_edit.py

    r1054 r1071  
    2727# Validate the document and write it if it's valid
    2828# (We don't call getEditableContent here, validate does it when needed.)
    29 info = context.getStudentInfo()
     29info = context.getApplicationInfo()
    3030
    3131if info is None:
     
    3636app = info['app']
    3737app_doc = info['app_doc']
    38 state = context.getStudentInfo()['review_state']
     38state = info['review_state']
    3939is_valid, ds = app_doc.validate(request=REQUEST,
    4040                                schema_id = 'student_application',
  • WAeUP_SRP/trunk/skins/waeup_student/application_edit_form.pt

    r1027 r1071  
    1 <metal:html tal:define="info context/getStudentInfo">
     1<metal:html tal:define="info context/getApplicationInfo">
    22  <span tal:condition="not: info">
    33    <metal:block use-macro="here/illegal_view/macros/illegal_view" />
  • WAeUP_SRP/trunk/skins/waeup_student/getStudentId.py

    r1067 r1071  
    1212return StudentId from request
    1313"""
     14
    1415ptl = context.REQUEST.get('PATH_TRANSLATED').split('/')
    1516try:
     
    1718except:
    1819    return None
    19 if len(ptl) > id_index + 2:
    20     return ptl[id_index + 1]
    21 return None
     20if len(ptl) <= id_index + 1:
     21    return None
     22student_id = ptl[id_index +1]
     23if len(student_id) != 7:
     24    return None
     25try:
     26    int(student_id[1:])
     27    return student_id
     28except:
     29    return None
  • WAeUP_SRP/trunk/skins/waeup_student/layout_application_edit.pt

    r803 r1071  
    88  formaction options/formaction|string:application_edit;
    99  creation creation|nothing;
    10   metadata metadata|nothing;
    11   type_name request/type_name|nothing;
    12   ti python:type_name and getattr(here.portal_types,type_name,None) or getattr(here.portal_types,here.portal_type,None);
    1310  cpsmcat nocall:here/translation_service;
    1411  proceed options/proceed|nothing;
  • WAeUP_SRP/trunk/skins/waeup_student/search_students.py

    r1065 r1071  
    7272        departments = [f.getId for f in res]
    7373    user_info['departments'] = departments
    74 default = {'search_mode': 'name',
     74default = {'search_mode': 'student_id',
    7575        'review_state': state,
    7676        'search_string': ''
     
    114114                             allowed = True,
    115115                             )
     116st_queries = ('jamb_reg_no','matric_no','name')
     117review_res = None
     118query = None
    116119items = []
    117120res = []
    118 portal_type_query = {'query':['Student','StudentApplication','StudentPersonal']}
    119 st_queries = ('jamb_reg_no','matric_no','name')
    120 query_step = 0
    121 review_res = None
    122 query = None
    123121review_set = []
    124122search_set = []
     
    126124    if what == "student_id":
    127125        students_folder = context.portal_url.getPortalObject().campus.students
    128         query_step = 1
    129126        if hasattr(students_folder,term.strip()):
    130127            request.RESPONSE.redirect("%s/%s" % (students_folder.absolute_url(),term))
     
    139136    elif what in st_queries:
    140137        if what == "jamb_reg_no":
    141             query_step = 2
    142138            pt = ('StudentApplication',)
    143139            st = "%s" % term.strip().lower()
    144140        elif what == "matric_no":
    145             query_step = 3
    146141            pt = ('StudentClearance',)
    147142            st = "%s" % term.strip().lower()
    148143        elif what == "name":
    149             query_step = 4
    150144            pt = ('StudentPersonal')
    151145            st = "%s" % term.strip()
    152146        query = In('portal_type',pt) & Eq('SearchableText',"%s*" % term.strip())
    153147        res = evalAdvancedQuery(query)
    154         search_set = []
    155148        if res:
    156149            for r in res:
     
    164157    res = aq_students(query)
    165158    search_set = [r.id for r in res]
    166 ##        res = context.students_catalog(faculty=faculties[0],)
    167 ##        res = context.students_catalog(faculty=faculties,department=departments)
    168 #set_trace()
    169 if with_review:
    170     query_step += 10
    171     #review_res = evalAdvancedQuery(('portal_type',student_objects) & Eq('review_state',state))
    172     review_res = evalAdvancedQuery(Eq('review_state',state))
     159if with_review and len(search_set) > 0:
     160    query = In('id',search_set) & Eq('review_state',state)
     161elif with_review:
     162    query = Eq('review_state',state)
     163    review_res = evalAdvancedQuery(query)
    173164review_set = []
    174165if review_res:
     
    177168        #review_set.append(pl[pl.index('students') + 1])
    178169        review_set.append(r.getId)
    179 all = []
     170all = review_set
    180171#set_trace()
    181 if only_review:
    182     all = review_set
    183 elif with_review:
    184     for i in search_set:
    185         if i in review_set:
    186             all.append(i)
    187 else:
    188     all = search_set
    189 ##for a in all[:50]:
    190 ##    if a in items:
    191 ##        continue
    192 ##    items.append(a)
     172##if only_review:
     173##    all = review_set
     174##elif with_review:
     175##    for i in search_set:
     176##        if i in review_set:
     177##            all.append(i)
     178##else:
     179##    all = search_set
     180####for a in all[:50]:
     181####    if a in items:
     182####        continue
     183####    items.append(a)
    193184items = all[:500]
    194185students = []
Note: See TracChangeset for help on using the changeset viewer.