Ignore:
Timestamp:
20 Oct 2016, 12:48:21 (8 years ago)
Author:
Henrik Bettermann
Message:

Customize RIAAContractExporter.mangle_value.

Location:
main/ikobacustom.uniben/trunk/src/ikobacustom/uniben/customers
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • main/ikobacustom.uniben/trunk/src/ikobacustom/uniben/customers/export.py

    r14197 r14219  
    5858    title = _(u'RIAA Customer Contracts')
    5959    class_name = 'RIAAContract'
     60
     61    def mangle_value(self, value, name, context=None):
     62
     63        if name == 'history':
     64            return value.messages
     65        mangled_value = getattr(value, 'document_id', None)
     66        if mangled_value:
     67            return mangled_value
     68        mangled_value = getattr(value, 'product_id', None)
     69        if mangled_value:
     70            return mangled_value
     71        if name == 'product_options' and value is not None:
     72            return [eval(entry.to_string()) for entry in value]
     73        return super(
     74            ContractExporterBase, self).mangle_value(
     75            value, name, context=context)
  • main/ikobacustom.uniben/trunk/src/ikobacustom/uniben/customers/tests/test_browser.py

    r14197 r14219  
    286286        self.contract.tc_dict = {'en': u'<strong>Hello world</strong>'}
    287287        self.contract.title = u'Contract Title'
    288         self.browser.open(self.customer_path + '/contracts/CON1')
     288        self.browser.open(self.customer_path + '/contracts/11111222223333344444555556666677')
    289289        self.browser.getLink("Download contract slip").click()
    290290        self.assertEqual(self.browser.headers['Status'], '200 Ok')
Note: See TracChangeset for help on using the changeset viewer.