Ignore:
Timestamp:
8 Dec 2014, 16:55:05 (10 years ago)
Author:
Henrik Bettermann
Message:

Use fantasy field names in base classes to point out that these names will be overridden in derived classes.

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  
    6666
    6767    # Headers needed to locate items...
    68     location_fields = ['code', 'faculty_code']
     68    location_fields = ['any_id']
    6969
    7070    # A factory with this name must be registered...
     
    227227                # Computed attributes can't be set.
    228228                continue
    229             log_value = getattr(value, 'code', value)
     229            log_value = getattr(value, 'any_id', value)
    230230            changed.append('%s=%s' % (key, log_value))
    231231
     
    418418
    419419    #: Fieldnames considered by this exporter
    420     fields = ('code', 'title', 'title_prefix')
     420    fields = ('any_id', 'any_title')
    421421
    422422    #: The title under which this exporter will be displayed
  • main/waeup.ikoba/trunk/src/waeup/ikoba/utils/tests/test_batching.py

    r11954 r12178  
    289289        exporter = ExporterBase()
    290290        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'))
    292292        outfile.seek(0)
    293293        self.assertEqual(
    294294            outfile.read(),
    295             'code,title,title_prefix\r\nA,B,C\r\n')
     295            'any_id,any_title\r\nA,B\r\n')
    296296        return
    297297
     
    300300        exporter = ExporterBase()
    301301        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'))
    303303        outfile.close()
    304304        resultfile = open(self.workfile, 'rb')
    305305        self.assertEqual(
    306306            resultfile.read(),
    307             'code,title,title_prefix\r\nA,B,C\r\n')
     307            'any_id,any_title\r\nA,B\r\n')
    308308        return
    309309
     
    313313        writer, outfile = exporter.get_csv_writer()
    314314        class Sample(object):
    315             code = 'A'
    316             title = u'B'
    317             title_prefix = True
     315            any_id = 'A'
     316            any_title = u'B'
    318317        exporter.write_item(Sample(), writer)
    319318        outfile.seek(0)
    320319        self.assertEqual(
    321320            outfile.read(),
    322             'code,title,title_prefix\r\nA,B,1\r\n')
     321            'any_id,any_title\r\nA,B\r\n')
    323322        return
    324323
     
    328327        writer, outfile = exporter.get_csv_writer()
    329328        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')
    331330        return
    332331
Note: See TracChangeset for help on using the changeset viewer.