- Timestamp:
- 15 Nov 2007, 15:06:02 (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
WAeUP_SRP/base/WAeUPTool.py
r2656 r2666 299 299 def dumpSchoolfeePayments(self): 300 300 "dump paid schoolfees" 301 mtool = self.portal_membership 302 member = mtool.getAuthenticatedMember() 301 303 logger = logging.getLogger('WAeUPTool.dumpSchoolfees') 302 304 aq_student = self.students_catalog.evalAdvancedQuery … … 306 308 )) 307 309 res = aq_student(query) 308 import pdb;pdb.set_trace()310 #import pdb;pdb.set_trace() 309 311 l = [] 310 312 logger.info("start for %d" % len(res)) … … 319 321 d = {} 320 322 d['student_id'] = student.id 321 d['amount'] = fee_dict.get('new') 323 d['name'] = student.name 324 d['amount'] = fee_dict.get(new_returning) 322 325 l += d, 323 import pdb;pdb.set_trace() 326 csv_name = self.dumpListToCSV(l,'payments') 327 logger.info('%s dumped payments to %s' % (member,export_file)) 328 ###) 329 330 security.declarePublic('dumpListToCSV') ###( 331 def dumpListToCSV(self,l,filename,fields=None): 332 """dump a list of dicts to a CSV file""" 333 current = DateTime.DateTime().strftime("%d-%m-%y_%H_%M_%S") 334 export_file = "%s/export/%s_%s.csv" % (i_home,filename,current,) 335 if fields is None: 336 fields = l[0].keys() 337 headline = ','.join(fields) 338 out = open(export_file,"wb") 339 out.write(headline +'\n') 340 out.close() 341 out = open(export_file,"a") 342 csv_writer = csv.DictWriter(out,fields,) 343 csv_writer.writerows(l) 344 return export_file 324 345 ###) 325 346
Note: See TracChangeset for help on using the changeset viewer.