Changeset 3362 for WAeUP_SRP/base
- Timestamp:
- 20 Mar 2008, 16:20:15 (17 years ago)
- Location:
- WAeUP_SRP/base
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
WAeUP_SRP/base/WAeUPTables.py
r3354 r3362 1481 1481 def addMultipleRecords(self, records): ###( 1482 1482 """add many records""" 1483 added_keys = []1483 existing_uids = [] 1484 1484 for data in records: 1485 uid = key ="%(student_id)s|%(level_id)s|%(course_id)s" % data1485 uid = "%(student_id)s|%(level_id)s|%(course_id)s" % data 1486 1486 data['%s' % self.key] = uid 1487 res = self.searchResults({"%s" % self.key : uid}) 1487 query = Eq(self.key, uid) 1488 res = self.course_results.evalAdvancedQuery(query) 1488 1489 if len(res) > 0: 1489 raise ValueError("More than one record with uid %s" % uid) 1490 rec = res[0] 1491 equal = True 1492 for attr in ('student_id','level_id','course_id'): 1493 if getattr(rec,attr,'') != data[attr]: 1494 equal = False 1495 break 1496 if equal: 1497 existing_uids += uid, 1498 continue 1490 1499 self.catalog_object(dict2ob(data), uid=uid) 1491 return uid1500 return existing_uids 1492 1501 ###) 1493 1502 1494 1503 def deleteResultsHere(self,level_id,student_id): ###( 1495 #import pdb;pdb.set_trace()1496 1504 query = Eq('student_id',student_id) & Eq('level_id', level_id) 1497 1505 course_results = self.course_results.evalAdvancedQuery(query) 1506 #import pdb;pdb.set_trace() 1498 1507 for result in course_results: 1499 1508 self.deleteRecord(result.key) -
WAeUP_SRP/base/skins/waeup_student/create_level.py
r3074 r3362 176 176 177 177 if records: 178 context.course_results.addMultipleRecords(records) 178 existing_uids = context.course_results.addMultipleRecords(records) 179 if existing_uids: 180 logger.info('%s level %s %s existing keys' % (student.id, 181 current_level, 182 ",".join(existing_uids))) 183 179 184 logger.info('%s finished to create level %s' % (student.id,current_level)) 180 185 -
WAeUP_SRP/base/skins/waeup_student/level_delete.py
r2817 r3362 12 12 delete a level, fix students review if necessary 13 13 """ 14 try: 15 from Products.zdb import set_trace 16 except: 17 def set_trace(): 18 pass 14 19 15 20 import logging 16 logger = logging.getLogger('Skins. folder_delete')21 logger = logging.getLogger('Skins.level_delete') 17 22 member_id = str(context.portal_membership.getAuthenticatedMember()) 18 23 … … 50 55 for level_id in ids: 51 56 context.course_results.deleteResultsHere(level_id,student_id) 57 logger.info("%s deleted level(s) %s of %s" % (member_id,','.join(ids),student_id)) 52 58 here.manage_delObjects(ids) 53 54 59 message = 'portal_status_message=psm_item(s)_deleted' 55 60 else:
Note: See TracChangeset for help on using the changeset viewer.