Changeset 12401


Ignore:
Timestamp:
5 Jan 2015, 07:45:40 (12 years ago)
Author:
Henrik Bettermann
Message:

Rename PCNContract to emphasize that this contract deelas with licenses only.

Location:
main/ikobacustom.pcn/trunk/src/ikobacustom/pcn
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • main/ikobacustom.pcn/trunk/src/ikobacustom/pcn/customers/batching.py

    r12384 r12401  
    2626    IPCNCustomerJPGDocument,
    2727    IPCNCustomerPDFDocument,
    28     IPCNContract)
     28    IPCNLicenseContract)
    2929from ikobacustom.pcn.interfaces import MessageFactory as _
    3030
    … …  
    5757    factory_name = 'waeup.PCNCustomerPDFDocument'
    5858
    59 class PCNContractProcessor(ContractProcessorBase):
    60     """A batch processor for IPCNContract objects.
     59class PCNLicenseContractProcessor(ContractProcessorBase):
     60    """A batch processor for IPCNLicenseContract objects.
    6161    """
    62     util_name = 'pcncontractprocessor'
     62    util_name = 'pcnlicensecontractprocessor'
    6363    grok.name(util_name)
    6464    name = _('PCN Customer Contract Processor')
    65     iface = IPCNContract
    66     factory_name = 'waeup.PCNContract'
     65    iface = IPCNLicenseContract
     66    factory_name = 'waeup.PCNLicenseContract'
  • main/ikobacustom.pcn/trunk/src/ikobacustom/pcn/customers/contracts.py

    r12385 r12401  
    2828from ikobacustom.pcn.interfaces import MessageFactory as _
    2929from ikobacustom.pcn.customers.interfaces import (
    30     IPCNContract, IPCNContractEdit, IPCNContractProcess)
     30    IPCNLicenseContract, IPCNLicenseContractEdit, IPCNLicenseContractProcess)
    3131
    3232
    33 class PCNContract(ContractBase):
     33class PCNLicenseContract(ContractBase):
    3434    """This is a sample contract.
    3535    """
    3636
    3737    grok.implements(
    38         IPCNContractProcess,
    39         IPCNContract,
    40         IPCNContractEdit,
     38        IPCNLicenseContractProcess,
     39        IPCNLicenseContract,
     40        IPCNLicenseContractEdit,
    4141        ICustomerNavigation)
    4242
    4343    contract_category = 'license'
    4444
    45     form_fields_interface = IPCNContract
     45    form_fields_interface = IPCNLicenseContract
    4646
    47     edit_form_fields_interface = IPCNContractEdit
     47    edit_form_fields_interface = IPCNLicenseContractEdit
    4848
    49     check_docs_interface = IPCNContract
     49    check_docs_interface = IPCNLicenseContract
    5050
    51 PCNContract = attrs_to_fields(PCNContract)
     51PCNLicenseContract = attrs_to_fields(PCNLicenseContract)
    5252
    5353
    5454# Contracts must be importable. So we might need a factory.
    55 class PCNContractFactory(grok.GlobalUtility):
     55class PCNLicenseContractFactory(grok.GlobalUtility):
    5656    """A factory for contracts.
    5757    """
    5858    grok.implements(IFactory)
    59     grok.name(u'waeup.PCNContract')
    60     title = u"Create a new contract.",
    61     description = u"This factory instantiates new sample contract instances."
     59    grok.name(u'waeup.PCNLicenseContract')
     60    title = u"Create a new license contract.",
     61    description = u"This factory instantiates new license contract instances."
    6262
    6363    def __call__(self, *args, **kw):
    64         return PCNContract(*args, **kw)
     64        return PCNLicenseContract(*args, **kw)
    6565
    6666    def getInterfaces(self):
    67         return implementedBy(PCNContract)
     67        return implementedBy(PCNLicenseContract)
  • main/ikobacustom.pcn/trunk/src/ikobacustom/pcn/customers/export.py

    r12384 r12401  
    2323from ikobacustom.pcn.customers.interfaces import (
    2424    IPCNCustomer, IPCNCustomerJPGDocument,
    25     IPCNCustomerPDFDocument, IPCNContract)
     25    IPCNCustomerPDFDocument, IPCNLicenseContract)
    2626from ikobacustom.pcn.interfaces import MessageFactory as _
    2727
    … …  
    5050
    5151
    52 class PCNContractExporter(ContractExporterBase):
     52class PCNLicenseContractExporter(ContractExporterBase):
    5353    """Exporter for Contract instances.
    5454    """
    55     grok.name('pcncontracts')
    56     iface = IPCNContract
    57     title = _(u'PCN Customer Contracts')
    58     class_name = 'PCNContract'
     55    grok.name('pcnlicensecontracts')
     56    iface = IPCNLicenseContract
     57    title = _(u'PCN Customer License Contracts')
     58    class_name = 'PCNLicenseContract'
  • main/ikobacustom.pcn/trunk/src/ikobacustom/pcn/customers/interfaces.py

    r12384 r12401  
    4646# Customer contract interfaces
    4747
    48 class IPCNContract(IContract):
     48class IPCNLicenseContract(IContract):
    4949    """A customer contract sample with document attached.
    5050
    … …  
    5757        )
    5858
    59 class IPCNContractProcess(IPCNContract):
     59class IPCNLicenseContractProcess(IPCNLicenseContract):
    6060    """Interface for processing contract data.
    6161    """
    … …  
    6969        )
    7070
    71 class IPCNContractEdit(IPCNContract):
     71class IPCNLicenseContractEdit(IPCNLicenseContract):
    7272    """Interface for editing sample contract data by customers.
    7373
  • main/ikobacustom.pcn/trunk/src/ikobacustom/pcn/customers/tests/test_browser.py

    r12390 r12401  
    3434    PCNCustomerPDFDocumentExporter,
    3535    PCNCustomerJPGDocumentExporter,
    36     PCNContractExporter)
     36    PCNLicenseContractExporter)
    3737from ikobacustom.pcn.customers.batching import (
    3838    PCNCustomerProcessor,
    3939    PCNCustomerPDFDocumentProcessor,
    4040    PCNCustomerJPGDocumentProcessor,
    41     PCNContractProcessor)
     41    PCNLicenseContractProcessor)
    4242from ikobacustom.pcn.testing import FunctionalLayer, samples_dir
    4343
    … …  
    6868        customer['documents'].addDocument(document1)
    6969        customer['documents'].addDocument(document2)
    70         contract = createObject(u'waeup.PCNContract')
     70        contract = createObject(u'waeup.PCNLicenseContract')
    7171        contract.tc_dict = {'en':u'Hello World'}
    7272        customer['contracts'].addContract(contract)
    … …  
    210210        # set values we can expect in export file
    211211        self.setup_for_export()
    212         exporter = PCNContractExporter()
     212        exporter = PCNLicenseContractExporter()
    213213        exporter.export_all(self.app, self.outfile)
    214214        result = open(self.outfile, 'rb').read()
    … …  
    217217            'history,last_product_id,product_object,product_options,'
    218218            'state,tc_dict,title,user_id\r\n'
    219             'PCNContract,license,%s,,'
     219            'PCNLicenseContract,license,%s,,'
    220220            '[u\'2014-12-21 22:26:00 WAT - Contract created by system\']'
    221221            ',,,[],created,{\'en\': u\'Hello World\'},,K1000000\r\n'
    222222            % self.contract.contract_id)
    223223        # We can reimport the file if we change the header (user_id -> customer_id)
    224         processor = PCNContractProcessor()
     224        processor = PCNLicenseContractProcessor()
    225225        open(self.outfile, 'wb').write(
    226226            'class_name,contract_category,contract_id,document_object,'
    227227            'history,last_product_id,product_object,product_options,'
    228228            'state,tc_dict,title,user_id\r\n'
    229             'PCNContract,license,%s,,'
     229            'PCNLicenseContract,license,%s,,'
    230230            '[u\'2014-12-21 22:26:00 WAT - Contract created by system\']'
    231231            ',,,[],created,{\'en\': u\'Hello World\'},,K1000000\r\n'
    … …  
    270270        self._contract_category = u'license'
    271271        self._document_factory = 'waeup.PCNCustomerPDFDocument'
    272         self._contract_factory = 'waeup.PCNContract'
     272        self._contract_factory = 'waeup.PCNLicenseContract'
    273273        return
    274274
    … …  
    322322        self._contract_category = u'license'
    323323        self._document_factory = 'waeup.PCNCustomerPDFDocument'
    324         self._contract_factory = 'waeup.PCNContract'
     324        self._contract_factory = 'waeup.PCNLicenseContract'
    325325        return
    326326
  • main/ikobacustom.pcn/trunk/src/ikobacustom/pcn/customers/tests/test_contract.py

    r12371 r12401  
    2929
    3030from ikobacustom.pcn.testing import (FunctionalLayer, FunctionalTestCase)
    31 from ikobacustom.pcn.customers.contracts import PCNContract
    32 from ikobacustom.pcn.customers.interfaces import IPCNContract
     31from ikobacustom.pcn.customers.contracts import PCNLicenseContract
     32from ikobacustom.pcn.customers.interfaces import IPCNLicenseContract
    3333
    3434
    … …  
    3838
    3939    def test_interfaces(self):
    40         verify.verifyClass(IPCNContract, PCNContract)
    41         verify.verifyClass(ICustomerNavigation, PCNContract)
    42         verify.verifyObject(IPCNContract, PCNContract())
    43         verify.verifyObject(ICustomerNavigation, PCNContract())
     40        verify.verifyClass(IPCNLicenseContract, PCNLicenseContract)
     41        verify.verifyClass(ICustomerNavigation, PCNLicenseContract)
     42        verify.verifyObject(IPCNLicenseContract, PCNLicenseContract())
     43        verify.verifyObject(ICustomerNavigation, PCNLicenseContract())
    4444        return
    4545
    4646    def test_addContract(self):
    4747        container = ContractsContainer()
    48         contract = createObject(u'waeup.PCNContract')
     48        contract = createObject(u'waeup.PCNLicenseContract')
    4949        id = contract.contract_id
    5050        container.addContract(contract)
    5151        self.assertEqual(container[id], contract)
    5252        self.assertRaises(TypeError, container.addContract, object())
    53         self.assertEqual(contract.class_name, 'PCNContract')
     53        self.assertEqual(contract.class_name, 'PCNLicenseContract')
    5454        return
  • main/ikobacustom.pcn/trunk/src/ikobacustom/pcn/customers/utils.py

    r12384 r12401  
    5454        #'SampleContract': _('Sample Contract'),
    5555
    56         'PCNContract': _('PCN Contract'),
     56        'PCNLicenseContract': _('PCN License Contract'),
    5757        }
    5858
    … …  
    6565        'pcncustomerjpgdocuments',
    6666        'pcncustomerpdfdocuments',
    67         'pcncontracts')
     67        'pcnlicensecontracts')
  • main/ikobacustom.pcn/trunk/src/ikobacustom/pcn/utils/utils.py

    r12385 r12401  
    6767        'pcncustomerjpgdocuments',
    6868        'pcncustomerpdfdocuments',
    69         'pcncontracts')
     69        'pcnlicensecontracts')
    7070
    7171    BATCH_PROCESSOR_NAMES = (
    … …  
    7373        'pcncustomerjpgdocumentprocessor',
    7474        'pcncustomerpdfdocumentprocessor',
    75         'pcncontractprocessor',
     75        'pcnlicensecontractprocessor',
    7676        'pcnproductprocessor',
    7777        'pdfdocumentprocessor',
Note: See TracChangeset for help on using the changeset viewer.