Changeset 2069 for WAeUP_SRP/trunk
- Timestamp:
- 27 Jul 2007, 16:04:30 (17 years ago)
- Location:
- WAeUP_SRP/trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
WAeUP_SRP/trunk/WAeUPTables.py
r2039 r2069 89 89 raise NotImplemented 90 90 91 def modifyRecord(self, **data):91 def modifyRecord(self, record=None, **data): 92 92 #records = self.searchResults(uid=uid) 93 93 uid = data[self.key] 94 records = self.searchResults({"%s" % self.key : uid}) 95 if len(records) > 1: 96 # Can not happen, but anyway... 97 raise ValueError("More than one record with uid %s" % uid) 98 if len(records) == 0: 99 raise KeyError("No record for uid %s" % uid) 100 record = records[0] 94 if record is None: 95 records = self.searchResults({"%s" % self.key : uid}) 96 if len(records) > 1: 97 # Can not happen, but anyway... 98 raise ValueError("More than one record with uid %s" % uid) 99 if len(records) == 0: 100 raise KeyError("No record for uid %s" % uid) 101 record = records[0] 101 102 record_data = {} 102 103 for field in self.schema() + self.indexes(): … … 237 238 affected_types = { ###( 238 239 'StudentApplication': 239 240 241 242 243 244 245 246 240 {'id': 'application', 241 'fields': 242 ('jamb_reg_no', 243 'entry_mode', 244 #'entry_level', 245 'entry_session', 246 ) 247 }, 247 248 'StudentClearance': 248 {'id': 'clearance', 249 'fields': 250 ('matric_no', 251 ) 252 }, 253 'StudentPersonal': 254 {'id': 'personal', 255 'fields': 256 ('name', 257 'sex', 258 'email', 259 'phone', 260 ) 261 }, 262 'StudentStudyCourse': 263 {'id': 'study_course', 264 'fields': 265 ('course', 266 'faculty', 267 'department', 268 'level', 269 'mode', 270 'session', 271 'verdict', 272 ) 273 }, 274 } 249 {'id': 'clearance', 250 'fields': 251 ('matric_no', 252 'lga', 253 ) 254 }, 255 'StudentPersonal': 256 {'id': 'personal', 257 'fields': 258 ('name', 259 'sex', 260 'perm_address', 261 'email', 262 'phone', 263 ) 264 }, 265 'StudentStudyCourse': 266 {'id': 'study_course', 267 'fields': 268 ('course', # study_course 269 'faculty', # from certificate 270 'department', # from certificate 271 'end_level', # from certificate 272 'level', # current_level 273 'mode', # current_mode 274 'session', # current_session 275 'verdict', # current_verdict 276 ) 277 }, 278 } 275 279 ###) 276 280 … … 326 330 return None 327 331 return certificate_res[0].getPath().split('/')[-4] 332 333 def get_from_doc_end_level(self,doc): ###( 334 "return the students end_level" 335 if doc is None: 336 return None 337 certificate_res = self.portal_catalog(id = doc.study_course) 338 if len(certificate_res) != 1: 339 return None 340 return getattr(certificate_res[0].getObject().getContent(),'end_level','unknown') 328 341 329 342 def get_from_doc_level(self,doc): … … 579 592 data['id'] = student_id 580 593 data['registered_courses'] = registered_courses 581 self.modifyRecord( **data)594 self.modifyRecord(record = student_rec, **data) 582 595 return 583 596 if pt not in self.affected_types.keys(): … … 653 666 654 667 meta_type = 'WAeUP Courses Catalog' 655 name = " students_catalog"668 name = "courses_catalog" 656 669 key = "code" 657 670 def __init__(self): … … 782 795 ###) 783 796 797 class ResultsCatalog(WAeUPTable): ###( 798 security = ClassSecurityInfo() 799 800 meta_type = 'WAeUP Results Catalog' 801 name = "course_results" 802 key = "key" 803 def __init__(self): 804 WAeUPTable.__init__(self, 'course_results') 805 806 def manage_catalogReindex(self, REQUEST, RESPONSE, URL1): ###( 807 """ clear the catalog, then re-index everything """ 808 809 elapse = time.time() 810 c_elapse = time.clock() 811 812 pgthreshold = self._getProgressThreshold() 813 handler = (pgthreshold > 0) and ZLogHandler(pgthreshold) or None 814 #self.refreshCatalog(clear=1, pghandler=handler) 815 816 elapse = time.time() - elapse 817 c_elapse = time.clock() - c_elapse 818 819 RESPONSE.redirect( 820 URL1 + 821 '/manage_catalogAdvanced?manage_tabs_message=' + 822 urllib.quote('Catalog Updated \n' 823 'Total time: %s\n' 824 'Total CPU time: %s' % (`elapse`, `c_elapse`))) 825 ###) 826 827 828 InitializeClass(ResultsCatalog) 829 ###) 830 784 831 class OnlinePaymentsImport(WAeUPTable): ###( 785 832 … … 791 838 792 839 793 InitializeClass( CoursesCatalog)840 InitializeClass(OnlinePaymentsImport) 794 841 ###) 795 842 -
WAeUP_SRP/trunk/profiles/default/students_catalog.xml
r1749 r2069 15 15 <index name="name" meta_type="TextIndex"> 16 16 <indexed_attr value="name"/> 17 </index> 18 <index name="perm_address" meta_type="TextIndex"> 19 <indexed_attr value="perm_address"/> 17 20 </index> 18 21 <index name="jamb_reg_no" meta_type="FieldIndex"> … … 40 43 <indexed_attr value="level"/> 41 44 </index> 45 <index name="end_level" meta_type="FieldIndex"> 46 <indexed_attr value="end_level"/> 47 </index> 48 <index name="lga" meta_type="FieldIndex"> 49 <indexed_attr value="lga"/> 50 </index> 42 51 <index name="mode" meta_type="FieldIndex"> 43 52 <indexed_attr value="mode"/> … … 62 71 <column value="course"/> 63 72 <column value="registered_courses"/> 73 <column value="lga"/> 74 <column value="perm_address"/> 64 75 <column value="email"/> 65 76 <column value="phone"/> 66 77 <column value="level"/> 78 <column value="end_level"/> 67 79 <column value="mode"/> 68 80 <column value="verdict"/>
Note: See TracChangeset for help on using the changeset viewer.