Changeset 2128
- Timestamp:
- 20 Aug 2007, 08:17:12 (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
WAeUP_SRP/trunk/Students.py
r2125 r2128 1051 1051 fields.append('state') 1052 1052 headline = ','.join(fields) 1053 open(export_file,"a").write(headline +'\n') 1053 #open(export_file,"a").write(headline +'\n') 1054 out = open(export_file,"wb") 1055 out.write(headline +'\n') 1056 out.close() 1057 out = open(export_file,"a") 1058 csv_writer = csv.DictWriter(out,fields,) 1054 1059 format = '"%(' + ')s","%('.join(fields) + ')s"' 1055 1060 students = self.students_catalog() … … 1064 1069 d = self.getFormattedStudentEntry(student) 1065 1070 d['state'],d['lga'] = formatLGA(d['lga'],voc = self.portal_vocabularies.local_gov_areas) 1066 lines.append(format % d) 1071 #lines.append(format % d) 1072 lines.append(d) 1067 1073 total += 1 1068 1074 if total and not total % chunk or total == len(students): 1069 open(export_file,"a").write('\n'.join(lines) +'\n') 1075 #open(export_file,"a").write('\n'.join(lines) +'\n') 1076 csv_writer.writerows(lines) 1070 1077 anz = len(lines) 1071 1078 logger.info("wrote %(anz)d total written %(total)d" % vars())
Note: See TracChangeset for help on using the changeset viewer.