Ignore:
Timestamp:
17 Nov 2012, 20:47:02 (12 years ago)
Author:
Henrik Bettermann
Message:

See email 'Re: AsyncReportJob?'.

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

Legend:

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

    r9668 r9670  
    134134            self.args[0], self.mode, self.author)
    135135
    136     def __str__(self):
    137         """A nice human readable representation of a StudentsReport.
    138 
    139         Includes infos about session, mode and creation datetime.
    140         """
    141         return 'Students Report [session=%s, mode=%s] of %s ' % (
     136    #def __str__(self):
     137    #    """A nice human readable representation of a StudentsReport.
     138
     139    #    Includes infos about session, mode and creation datetime.
     140    #    """
     141    #    return 'Students Report [session=%s, mode=%s] of %s ' % (
     142    #        self.session, self.mode, self._creation_dt_string)
     143
     144    @property
     145    def title(self):
     146        title = 'StudentsReport_%s_%s_%s' % (
    142147            self.session, self.mode, self._creation_dt_string)
     148        title = title.replace('/', '_').replace(' ','_')
     149        return title
    143150
    144151    def create_pdf(self):
     
    234241
    235242    def render(self):
    236         filename = "%s.pdf" % (self.context.__repr__())
     243        filename = "%s.pdf" % (self.context.title)
    237244        self.response.setHeader(
    238245            'Content-Type', 'application/pdf')
  • main/waeup.kofa/trunk/src/waeup/kofa/students/tests/test_reports.py

    r9669 r9670  
    3333        return
    3434
    35     def test_str(self):
    36         # StudentsReport provide a nice string representation
     35    #def test_str(self):
     36    #    # StudentsReport provide a nice string representation
     37    #    obj = StudentsReport(2010, 'Undergraduate Full-Time', author='Bob')
     38    #    self.assertEqual(
     39    #        obj.__str__()[:65],
     40    #        'Students Report '
     41    #        '[session=2010/2011, mode=Undergraduate Full-Time]')
     42    #    return
     43
     44    def test_title(self):
    3745        obj = StudentsReport(2010, 'Undergraduate Full-Time', author='Bob')
    38         self.assertEqual(
    39             obj.__str__()[:65],
    40             'Students Report '
    41             '[session=2010/2011, mode=Undergraduate Full-Time]')
     46        self.assertTrue(
     47            obj.title.startswith(
     48            'StudentsReport_2010_2011_Undergraduate_Full-Time_'))
    4249        return
    4350
Note: See TracChangeset for help on using the changeset viewer.