Changeset 589
- Timestamp:
- 29 Sep 2006, 06:59:13 (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
WAeUP_SRP/trunk/skins/waeup_student/searchStudents.py
r587 r589 12 12 return Info about the current Student 13 13 """ 14 #from Products.ZCTextIndex.QueryParser import ParseError,QueryError 14 15 request = context.REQUEST 15 16 form = request.form … … 55 56 if state == " ----- ": 56 57 state = '' 58 err = False 57 59 if not term and what in ('student_edit','jamb_id','name','matric_no'): 60 psm = "You must specify a search string" 61 err = True 62 elif '*' in term: 63 psm = "You cannot use '*'" 64 err = True 65 if err: 58 66 return context.students_manager_view(rendered = rend, 59 psm = "You must specify a search string",67 psm = psm, 60 68 #psm = "%s, %s" % (psm,ds), 61 69 students = items, … … 66 74 res = [] 67 75 portal_type_query = {'query':['Student','StudentApplication','StudentPersonal']} 76 st_queries = ('jamb_id','matric_no','name') 68 77 if onlyreview: 69 78 res = catalog(portal_type=portal_type_query, … … 72 81 res = catalog(portal_type='Student', 73 82 id = term.strip()) 74 elif what == "jamb_id": 75 res = catalog(portal_type='StudentApplication', 76 SearchableText="%s*" % term.strip().lower()) 77 elif what == "matric_no": 78 res = catalog(portal_type='StudentClearance', 79 SearchableText="%s*" % term.strip().lower()) 80 elif what == "name": 81 res = catalog(portal_type=portal_type_query, 82 SearchableText="%s*" % term.strip()) 83 elif what in st_queries: 84 if what == "jamb_id": 85 pt = 'StudentApplication' 86 st = "%s*" % term.strip().lower() 87 elif what == "matric_no": 88 pt = 'StudentClearance' 89 st = "%s*" % term.strip().lower() 90 elif what == "name": 91 pt = portal_type_query 92 st = "%s*" % term.strip() 93 try: 94 res = catalog(portal_type=pt,SearchableText=st,) 95 except: 96 return context.students_manager_view(rendered = rend, 97 psm = 'Searchstring "%s" not allowed' % term, 98 #psm = "%s, %s" % (psm,ds), 99 students = items, 100 is_manager = is_manager, 101 ) 102 83 103 if res: 84 104 for r in res: 85 row = {}86 105 if r.portal_type in ("StudentApplication","StudentPersonal"): 87 items.append(r.getObject().aq_parent)106 student = r.getObject().aq_parent 88 107 else: 89 items.append(r.getObject()) 108 student = r.getObject() 109 if student not in items: 110 items.append(student) 90 111 students = [] 91 112 if items:
Note: See TracChangeset for help on using the changeset viewer.