Changeset 12178 for main/waeup.ikoba/trunk/src/waeup
- Timestamp:
- 8 Dec 2014, 16:55:05 (10 years ago)
- Location:
- main/waeup.ikoba/trunk/src/waeup/ikoba/utils
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.ikoba/trunk/src/waeup/ikoba/utils/batching.py
r11949 r12178 66 66 67 67 # Headers needed to locate items... 68 location_fields = [' code', 'faculty_code']68 location_fields = ['any_id'] 69 69 70 70 # A factory with this name must be registered... … … 227 227 # Computed attributes can't be set. 228 228 continue 229 log_value = getattr(value, ' code', value)229 log_value = getattr(value, 'any_id', value) 230 230 changed.append('%s=%s' % (key, log_value)) 231 231 … … 418 418 419 419 #: Fieldnames considered by this exporter 420 fields = (' code', 'title', 'title_prefix')420 fields = ('any_id', 'any_title') 421 421 422 422 #: The title under which this exporter will be displayed -
main/waeup.ikoba/trunk/src/waeup/ikoba/utils/tests/test_batching.py
r11954 r12178 289 289 exporter = ExporterBase() 290 290 writer, outfile = exporter.get_csv_writer() 291 writer.writerow(dict( code='A', title='B', title_prefix='C'))291 writer.writerow(dict(any_id='A', any_title='B')) 292 292 outfile.seek(0) 293 293 self.assertEqual( 294 294 outfile.read(), 295 ' code,title,title_prefix\r\nA,B,C\r\n')295 'any_id,any_title\r\nA,B\r\n') 296 296 return 297 297 … … 300 300 exporter = ExporterBase() 301 301 writer, outfile = exporter.get_csv_writer(filepath=self.workfile) 302 writer.writerow(dict( code='A', title='B', title_prefix='C'))302 writer.writerow(dict(any_id='A', any_title='B')) 303 303 outfile.close() 304 304 resultfile = open(self.workfile, 'rb') 305 305 self.assertEqual( 306 306 resultfile.read(), 307 ' code,title,title_prefix\r\nA,B,C\r\n')307 'any_id,any_title\r\nA,B\r\n') 308 308 return 309 309 … … 313 313 writer, outfile = exporter.get_csv_writer() 314 314 class Sample(object): 315 code = 'A' 316 title = u'B' 317 title_prefix = True 315 any_id = 'A' 316 any_title = u'B' 318 317 exporter.write_item(Sample(), writer) 319 318 outfile.seek(0) 320 319 self.assertEqual( 321 320 outfile.read(), 322 ' code,title,title_prefix\r\nA,B,1\r\n')321 'any_id,any_title\r\nA,B\r\n') 323 322 return 324 323 … … 328 327 writer, outfile = exporter.get_csv_writer() 329 328 result = exporter.close_outfile(None, outfile) 330 self.assertEqual(result, ' code,title,title_prefix\r\n')329 self.assertEqual(result, 'any_id,any_title\r\n') 331 330 return 332 331
Note: See TracChangeset for help on using the changeset viewer.