Changeset 7973


Ignore:
Timestamp:
23 Mar 2012, 08:15:58 (13 years ago)
Author:
Henrik Bettermann
Message:

Add the hash symbol at the end of date_of_birth.

This is to avoid annoying automatic date transformation by Excel or Calc.

Location:
main/waeup.kofa/trunk/src/waeup/kofa/students
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • main/waeup.kofa/trunk/src/waeup/kofa/students/export.py

    r7944 r7973  
    2222    title = _(u'Students')
    2323
     24    def mangle_value(self, value, name, context=None):
     25        """Add the hash symbol at the end of date_of_birth.
     26
     27        This is to avoid annoying automatic date transformation
     28        by Excel or Calc.
     29        """
     30        if name == 'date_of_birth':
     31            value = str(value) + '#'
     32        return super(
     33            StudentsExporter, self).mangle_value(
     34            value, name, context=context)
     35
    2436    def export(self, students, filepath=None):
    2537        """Export `students`, an iterable, as CSV file.
  • main/waeup.kofa/trunk/src/waeup/kofa/students/tests/test_export.py

    r7946 r7973  
    7070            'perm_address,phone,reg_number,sex,student_id\r\n'
    7171
    72             'my adm code,0,my clr code,1981-02-04,anna@sample.com,Anna,'
     72            'my adm code,0,my clr code,1981-02-04#,anna@sample.com,Anna,'
    7373            'Tester,M123456,M.,nigeria,"Studentroad 21\nLagos 123456\n",'
    7474            '+234-123-12345,123456,f,A111111\r\n'
     
    8989            'perm_address,phone,reg_number,sex,student_id\r\n'
    9090
    91             'my adm code,0,my clr code,1981-02-04,anna@sample.com,Anna,'
     91            'my adm code,0,my clr code,1981-02-04#,anna@sample.com,Anna,'
    9292            'Tester,M123456,M.,nigeria,"Studentroad 21\nLagos 123456\n",'
    9393            '+234-123-12345,123456,f,A111111\r\n'
Note: See TracChangeset for help on using the changeset viewer.