Changeset 257
- Timestamp:
- 20 Jun 2006, 14:50:46 (19 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
waeup_product/trunk/exportimport.py
r256 r257 135 135 logger = context.getLogger('loadfaculties') 136 136 logger.info('Start loading Faculties') 137 faculties = csv.DictReader(open("%s/import/faculty.csv" % i_home,"rb")) 137 try: 138 faculties = csv.DictReader(open("%s/import/faculty.csv" % i_home,"rb")) 139 except: 140 return 138 141 l = site.portal_catalog({'meta_type': "Faculty"}) 139 142 facs = {} … … 157 160 #return 158 161 logger = context.getLogger('loaddepartments') 159 deps = csv.DictReader(open("%s/import/departments.csv" % i_home,"rb")) 162 try: 163 deps = csv.DictReader(open("%s/import/departments.csv" % i_home,"rb")) 164 except: 165 return 160 166 l = site.portal_catalog({'meta_type': "Faculty"}) 161 167 facs = {} … … 184 190 #return 185 191 logger = context.getLogger('loadcourses') 186 courses = csv.DictReader(open("%s/import/courses.csv" % i_home,"rb")) 192 try: 193 courses = csv.DictReader(open("%s/import/courses.csv" % i_home,"rb")) 194 except: 195 return 187 196 l = site.portal_catalog({'meta_type': "Faculty"}) 188 197 facs = {} … … 202 211 if depid in deps.keys(): 203 212 dept= deps.get(depid) 204 elif depid in facs.keys():205 dept= facs.get(depid)213 ## elif depid in facs.keys(): 214 ## dept= facs.get(depid) 206 215 else: 207 216 logger.info("Dep %(Dept)s for Course %(CourseCode)s not found" % course) … … 237 246 #return 238 247 logger = context.getLogger('loadcertificates') 239 certificates = csv.DictReader(open("%s/import/certificates.csv" % i_home,"rb")) 248 try: 249 certificates = csv.DictReader(open("%s/import/certificates.csv" % i_home,"rb")) 250 except: 251 return 240 252 f_ids = [f.id for f in site.portal_catalog({'meta_type': "Faculty"})] 241 253 #d_ids = [d.id for d in site.portal_catalog({'meta_type': "Department"})] … … 344 356 def loadCertificateCoursesFromCSV(site,context): ###( 345 357 """install Certificate Courses from CSV values""" 346 return358 #return 347 359 logger = context.getLogger('loadcertificatecourses') 348 cert_courses = csv.DictReader(open("%s/import/course_level_courses.csv" % i_home,"rb")) 360 try: 361 cert_courses = csv.DictReader(open("%s/import/course_level_courses.csv" % i_home,"rb")) 362 except: 363 return 349 364 d_ids = [d.id for d in site.portal_catalog({'meta_type': "Department"})] 350 365 for cert_course in cert_courses:
Note: See TracChangeset for help on using the changeset viewer.