Changeset 10203 for main


Ignore:
Timestamp:
22 May 2013, 19:04:48 (11 years ago)
Author:
Henrik Bettermann
Message:

Customize getCertTitle.

Location:
main/waeup.futminna/trunk/src/waeup/futminna/applicants
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • main/waeup.futminna/trunk/src/waeup/futminna/applicants/tests/test_browser.py

    r10146 r10203  
    246246        fd = storage.getFile(file_id)
    247247        self.assertTrue(fd is None)
     248
     249    def test_certificate_source(self):
     250        self.browser.addHeader('Authorization', 'Basic mgr:mgrpw')
     251        self.browser.open(self.manage_path)
     252        self.assertTrue('value="CERT1">CERT1 - Unnamed Certificate</option>'
     253            in self.browser.contents)
     254        self.certificate.custom_textline_1 = u'Maths, Physics'
     255        self.certificate.custom_float_1 = 50.0
     256        self.browser.open(self.manage_path)
     257        self.assertTrue(
     258            'value="CERT1">CERT1 - Unnamed Certificate [Maths, Physics, 50]</option>'
     259            in self.browser.contents)
  • main/waeup.futminna/trunk/src/waeup/futminna/applicants/utils.py

    r10088 r10203  
    3333      'form.student_id': _(u'Process Data'),
    3434      }
     35
     36    def filterCertificates(self, context, resultset):
     37        """Filter and sort certificates in AppCatCertificateSource.
     38        """
     39        return sorted(resultset, key=lambda value: value.code)
     40
     41    def getCertTitle(self, context, value):
     42        """Compose the titles in AppCatCertificateSource.
     43        """
     44        if None not in (getattr(value, 'custom_textline_1'),
     45            getattr(value, 'custom_float_1')):
     46            return "%s - %s [%s, %d]" % (
     47                value.code, value.title,
     48                value.custom_textline_1, value.custom_float_1)
     49        return "%s - %s" % (value.code, value.title)
Note: See TracChangeset for help on using the changeset viewer.