- Timestamp:
- 18 Oct 2006, 06:27:03 (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
WAeUP_SRP/trunk/Academics.py
r718 r719 24 24 i_home = Globals.INSTANCE_HOME 25 25 26 def makeCertificateCode(code): 26 def makeCertificateCode(code): ###( 27 27 code = code.replace('.','') 28 28 code = code.replace('(','') … … 32 32 code = code.replace('_','') 33 33 return code 34 35 ###) 34 36 35 37 class AcademicsFolder(CPSDocument): ###( … … 105 107 "bank_code", 106 108 ) 107 format = ' '.join(['%%(%s)s' % fn for fn in fields])109 format = ','.join(['"%%(%s)s"' % fn for fn in fields]) 108 110 for faculty in faculties: 109 111 processing = "processing %s" % format … … 139 141 "faculty_code", 140 142 ) 141 format = ' '.join(['%%(%s)s' % fn for fn in fields])143 format = ','.join(['"%%(%s)s"' % fn for fn in fields]) 142 144 try: 143 145 deps = csv.DictReader(open("%s/import/%s.csv" % (i_home,name),"rb")) … … 146 148 return 147 149 no_import = open("%s/import/%s_not_imported.csv" % (i_home,name),"w") 148 heading = ' 150 heading = ','.join(['"%s"' % fn for fn in fields]) 149 151 no_import.write('%s\n' % heading) 150 152 l = self.portal_catalog({'meta_type': "Faculty"}) … … 200 202 "session", 201 203 ) 202 format = ' '.join(['%%(%s)s' % fn for fn in fields])204 format = ','.join(['"%%(%s)s"' % fn for fn in fields]) 203 205 try: 204 206 courses = csv.DictReader(open("%s/import/%s.csv" % (i_home,name),"rb")) … … 207 209 return 208 210 no_import = open("%s/import/%s_not_imported.csv" % (i_home,name),"w") 209 heading = ' 211 heading = ','.join(['"%s"' % fn for fn in fields]) 210 212 no_import.write('%s\n' % heading) 211 213 l = self.portal_catalog({'meta_type': "Faculty"}) … … 272 274 "admin_status", 273 275 ) 274 format = ' '.join(['%%(%s)s' % fn for fn in fields])276 format = ','.join(['"%%(%s)s"' % fn for fn in fields]) 275 277 try: 276 278 courses = csv.DictReader(open("%s/import/%s.csv" % (i_home,name),"rb")) … … 320 322 if no_import_list: 321 323 no_import = open("%s/import/%s_not_imported.csv" % (i_home,name),"w") 322 heading = ' 324 heading = ','.join(['"%s"' % fn for fn in fields]) 323 325 no_import.write('%s\n' % heading) 324 326 for line in no_import_list: … … 345 347 "core_or_elective", 346 348 ) 347 format = ' '.join(['%%(%s)s' % fn for fn in fields])349 format = ','.join(['"%%(%s)s"' % fn for fn in fields]) 348 350 try: 349 351 cert_courses = csv.DictReader(open("%s/import/%s.csv" % (i_home,name),"rb")) … … 367 369 logger.info(em) 368 370 #no_import_list.append(em) 369 no_import_list.append(format % cert_course + "CertificateCourse\n")371 no_import_list.append(format % cert_course + ',"Certificate"\n') 370 372 continue 371 373 certificate = certs[code] … … 375 377 logger.info(em) 376 378 #no_import_list.append(em) 377 no_import_list.append(format % cert_course + "Course\n")379 no_import_list.append(format % cert_course + ',"Course"\n') 378 380 continue 379 381 if depid not in d_ids: … … 381 383 logger.info(em) 382 384 #no_import_list.append(em) 383 no_import_list.append(format % cert_course + "Department\n")385 no_import_list.append(format % cert_course + ',"Department"\n') 384 386 continue 385 387 level = cert_course.get('level') … … 395 397 logger.info(msg) 396 398 #no_import_list.append(msg + "\n") 397 no_import_list.append(format % cert_course + "duplicate\n")399 no_import_list.append(format % cert_course + ',"duplicate"\n') 398 400 continue 399 401 l.invokeFactory('CertificateCourse',course_code) … … 413 415 if no_import_list: 414 416 no_import = open("%s/import/%s_not_imported.csv" % (i_home,name),"w") 415 heading = ' 417 heading = ','.join(['"%s"' % fn for fn in fields]) 416 418 no_import.write('%s\n' % heading) 417 419 for line in no_import_list:
Note: See TracChangeset for help on using the changeset viewer.