Changeset 9837


Ignore:
Timestamp:
7 Jan 2013, 08:30:59 (12 years ago)
Author:
Henrik Bettermann
Message:

Put job_id into filename and log job_id in order to identify who has created, downloaded and discarded exports.

Location:
main/waeup.kofa/trunk/src/waeup/kofa
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • main/waeup.kofa/trunk/src/waeup/kofa/browser/pages.py

    r9836 r9837  
    15891589        acronym = grok.getSite()['configuration'].acronym.replace(' ','')
    15901590        filename = "%s_%s" % (acronym, os.path.basename(path))
     1591        filename = filename.replace('.csv', '_%s.csv' % job_id)
    15911592        self.response.setHeader(
    15921593            'Content-Type', 'text/csv; charset=UTF-8')
  • main/waeup.kofa/trunk/src/waeup/kofa/browser/tests/test_browser.py

    r9836 r9837  
    211211                         'text/csv; charset=UTF-8')
    212212        self.assertEqual(self.browser.headers['content-disposition'],
    213                          'attachment; filename="WAeUP.Kofa_faculties.csv')
     213            'attachment; filename="WAeUP.Kofa_faculties_%s.csv' % job_id)
    214214        self.assertEqual(self.browser.contents,
    215215            'code,title,title_prefix,users_with_local_roles\r\n'
     
    227227                        'faculties, job_id=' in logcontent)
    228228        self.assertTrue('zope.mgr - browser.pages.ExportCSVView - '
    229                         'downloaded: WAeUP.Kofa_faculties.csv, job_id=' in logcontent)
     229                        'downloaded: WAeUP.Kofa_faculties_%s.csv, job_id=%s'
     230                        % (job_id, job_id) in logcontent)
    230231        return
    231232
     
    298299        self.browser.getLink("Download").click()
    299300        self.assertEqual(self.browser.headers['content-type'],
    300                          'text/csv; charset=UTF-8')
     301          'text/csv; charset=UTF-8')
    301302        self.assertEqual(self.browser.headers['content-disposition'],
    302                          'attachment; filename="WAeUP.Kofa_students.csv')
     303          'attachment; filename="WAeUP.Kofa_students_%s.csv' % job_id)
    303304        # No students yet
    304305        self.assertEqual(self.browser.contents,
     
    319320        self.assertTrue(
    320321            'zope.mgr - browser.pages.ExportCSVView '
    321             '- downloaded: WAeUP.Kofa_students.csv, job_id=' in logcontent)
     322            '- downloaded: WAeUP.Kofa_students_%s.csv, job_id=%s'
     323            % (job_id, job_id) in logcontent)
    322324        return
    323325
  • main/waeup.kofa/trunk/src/waeup/kofa/students/tests/test_browser.py

    r9836 r9837  
    27622762            'text/csv; charset=UTF-8')
    27632763        self.assertTrue(
    2764             'filename="WAeUP.Kofa_students.csv' in
     2764            'filename="WAeUP.Kofa_students_%s.csv' % job_id in
    27652765            self.browser.headers['content-disposition'])
    27662766        self.assertEqual(len(self.app['datacenter'].running_exports), 1)
     
    27802780        self.assertTrue(
    27812781            'zope.mgr - students.browser.ExportJobContainerDownload '
    2782             '- downloaded: WAeUP.Kofa_students.csv, job_id='
     2782            '- downloaded: WAeUP.Kofa_students_%s.csv, job_id=%s'
     2783            % (job_id, job_id)
    27832784            )
    27842785        self.assertTrue(
    27852786            'zope.mgr - students.browser.ExportJobContainerOverview '
    2786             '- discarded: job_id='
     2787            '- discarded: job_id=%s' % job_id
    27872788            )
Note: See TracChangeset for help on using the changeset viewer.