Changeset 12484 for main/ikobacustom.pcn/trunk/src/ikobacustom
- Timestamp:
- 18 Jan 2015, 08:19:27 (10 years ago)
- 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
r12401 r12484 26 26 IPCNCustomerJPGDocument, 27 27 IPCNCustomerPDFDocument, 28 I PCNLicenseContract)28 IRONContract) 29 29 from ikobacustom.pcn.interfaces import MessageFactory as _ 30 30 … … 57 57 factory_name = 'waeup.PCNCustomerPDFDocument' 58 58 59 class PCNLicenseContractProcessor(ContractProcessorBase):60 """A batch processor for I PCNLicenseContract objects.59 class RONContractProcessor(ContractProcessorBase): 60 """A batch processor for IRONContract objects. 61 61 """ 62 util_name = ' pcnlicensecontractprocessor'62 util_name = 'roncontractprocessor' 63 63 grok.name(util_name) 64 64 name = _('PCN Customer Contract Processor') 65 iface = I PCNLicenseContract66 factory_name = 'waeup. PCNLicenseContract'65 iface = IRONContract 66 factory_name = 'waeup.RONContract' -
main/ikobacustom.pcn/trunk/src/ikobacustom/pcn/customers/contracts.py
r12401 r12484 28 28 from ikobacustom.pcn.interfaces import MessageFactory as _ 29 29 from ikobacustom.pcn.customers.interfaces import ( 30 I PCNLicenseContract, IPCNLicenseContractEdit, IPCNLicenseContractProcess)30 IRONContract, IRONContractEdit, IRONContractProcess) 31 31 32 32 33 class PCNLicenseContract(ContractBase):33 class RONContract(ContractBase): 34 34 """This is a sample contract. 35 35 """ 36 36 37 37 grok.implements( 38 I PCNLicenseContractProcess,39 I PCNLicenseContract,40 I PCNLicenseContractEdit,38 IRONContractProcess, 39 IRONContract, 40 IRONContractEdit, 41 41 ICustomerNavigation) 42 42 43 43 contract_category = 'license' 44 44 45 form_fields_interface = I PCNLicenseContract45 form_fields_interface = IRONContract 46 46 47 edit_form_fields_interface = I PCNLicenseContractEdit47 edit_form_fields_interface = IRONContractEdit 48 48 49 check_docs_interface = I PCNLicenseContract49 check_docs_interface = IRONContract 50 50 51 PCNLicenseContract = attrs_to_fields(PCNLicenseContract)51 RONContract = attrs_to_fields(RONContract) 52 52 53 53 54 54 # Contracts must be importable. So we might need a factory. 55 class PCNLicenseContractFactory(grok.GlobalUtility):55 class RONContractFactory(grok.GlobalUtility): 56 56 """A factory for contracts. 57 57 """ 58 58 grok.implements(IFactory) 59 grok.name(u'waeup. PCNLicenseContract')59 grok.name(u'waeup.RONContract') 60 60 title = u"Create a new license contract.", 61 61 description = u"This factory instantiates new license contract instances." 62 62 63 63 def __call__(self, *args, **kw): 64 return PCNLicenseContract(*args, **kw)64 return RONContract(*args, **kw) 65 65 66 66 def getInterfaces(self): 67 return implementedBy( PCNLicenseContract)67 return implementedBy(RONContract) -
main/ikobacustom.pcn/trunk/src/ikobacustom/pcn/customers/export.py
r12401 r12484 23 23 from ikobacustom.pcn.customers.interfaces import ( 24 24 IPCNCustomer, IPCNCustomerJPGDocument, 25 IPCNCustomerPDFDocument, I PCNLicenseContract)25 IPCNCustomerPDFDocument, IRONContract) 26 26 from ikobacustom.pcn.interfaces import MessageFactory as _ 27 27 … … 50 50 51 51 52 class PCNLicenseContractExporter(ContractExporterBase):52 class RONContractExporter(ContractExporterBase): 53 53 """Exporter for Contract instances. 54 54 """ 55 grok.name(' pcnlicensecontracts')56 iface = I PCNLicenseContract55 grok.name('roncontracts') 56 iface = IRONContract 57 57 title = _(u'PCN Customer License Contracts') 58 class_name = ' PCNLicenseContract'58 class_name = 'RONContract' -
main/ikobacustom.pcn/trunk/src/ikobacustom/pcn/customers/interfaces.py
r12401 r12484 46 46 # Customer contract interfaces 47 47 48 class I PCNLicenseContract(IContract):48 class IRONContract(IContract): 49 49 """A customer contract sample with document attached. 50 50 51 51 """ 52 52 53 document_object = schema.Choice(54 title = _(u'Document'),55 source = CustomerDocumentSource(),56 required = False,57 )53 #document_object = schema.Choice( 54 # title = _(u'Document'), 55 # source = CustomerDocumentSource(), 56 # required = False, 57 # ) 58 58 59 class I PCNLicenseContractProcess(IPCNLicenseContract):59 class IRONContractProcess(IRONContract): 60 60 """Interface for processing contract data. 61 61 """ … … 69 69 ) 70 70 71 class I PCNLicenseContractEdit(IPCNLicenseContract):71 class IRONContractEdit(IRONContract): 72 72 """Interface for editing sample contract data by customers. 73 73 … … 80 80 ) 81 81 82 document_object = schema.Choice(83 title = _(u'Document'),84 source = CustomerDocumentSource(),85 required = True,86 )82 #document_object = schema.Choice( 83 # title = _(u'Document'), 84 # source = CustomerDocumentSource(), 85 # required = True, 86 # ) -
main/ikobacustom.pcn/trunk/src/ikobacustom/pcn/customers/tests/test_browser.py
r12460 r12484 34 34 PCNCustomerPDFDocumentExporter, 35 35 PCNCustomerJPGDocumentExporter, 36 PCNLicenseContractExporter)36 RONContractExporter) 37 37 from ikobacustom.pcn.customers.batching import ( 38 38 PCNCustomerProcessor, 39 39 PCNCustomerPDFDocumentProcessor, 40 40 PCNCustomerJPGDocumentProcessor, 41 PCNLicenseContractProcessor)41 RONContractProcessor) 42 42 from ikobacustom.pcn.testing import FunctionalLayer, samples_dir 43 43 … … 68 68 customer['documents'].addDocument(document1) 69 69 customer['documents'].addDocument(document2) 70 contract = createObject(u'waeup. PCNLicenseContract')70 contract = createObject(u'waeup.RONContract') 71 71 contract.tc_dict = {'en':u'Hello World'} 72 72 customer['contracts'].addContract(contract) … … 210 210 # set values we can expect in export file 211 211 self.setup_for_export() 212 exporter = PCNLicenseContractExporter()212 exporter = RONContractExporter() 213 213 exporter.export_all(self.app, self.outfile) 214 214 result = open(self.outfile, 'rb').read() … … 217 217 'history,last_product_id,product_object,product_options,' 218 218 'state,tc_dict,title,user_id\r\n' 219 ' PCNLicenseContract,license,%s,,'219 'RONContract,license,%s,,' 220 220 '[u\'2014-12-21 22:26:00 WAT - Contract created by system\']' 221 221 ',,,[],created,{\'en\': u\'Hello World\'},,K1000000\r\n' 222 222 % self.contract.contract_id) 223 223 # We can reimport the file if we change the header (user_id -> customer_id) 224 processor = PCNLicenseContractProcessor()224 processor = RONContractProcessor() 225 225 open(self.outfile, 'wb').write( 226 226 'class_name,contract_category,contract_id,document_object,' 227 227 'history,last_product_id,product_object,product_options,' 228 228 'state,tc_dict,title,user_id\r\n' 229 ' PCNLicenseContract,license,%s,,'229 'RONContract,license,%s,,' 230 230 '[u\'2014-12-21 22:26:00 WAT - Contract created by system\']' 231 231 ',,,[],created,{\'en\': u\'Hello World\'},,K1000000\r\n' … … 270 270 self._contract_category = u'license' 271 271 self._document_factory = 'waeup.PCNCustomerPDFDocument' 272 self._contract_factory = 'waeup. PCNLicenseContract'272 self._contract_factory = 'waeup.RONContract' 273 273 return 274 274 … … 326 326 self._contract_category = u'license' 327 327 self._document_factory = 'waeup.PCNCustomerPDFDocument' 328 self._contract_factory = 'waeup. PCNLicenseContract'328 self._contract_factory = 'waeup.RONContract' 329 329 return 330 330 -
main/ikobacustom.pcn/trunk/src/ikobacustom/pcn/customers/tests/test_contract.py
r12401 r12484 29 29 30 30 from ikobacustom.pcn.testing import (FunctionalLayer, FunctionalTestCase) 31 from ikobacustom.pcn.customers.contracts import PCNLicenseContract32 from ikobacustom.pcn.customers.interfaces import I PCNLicenseContract31 from ikobacustom.pcn.customers.contracts import RONContract 32 from ikobacustom.pcn.customers.interfaces import IRONContract 33 33 34 34 … … 38 38 39 39 def test_interfaces(self): 40 verify.verifyClass(I PCNLicenseContract, PCNLicenseContract)41 verify.verifyClass(ICustomerNavigation, PCNLicenseContract)42 verify.verifyObject(I PCNLicenseContract, PCNLicenseContract())43 verify.verifyObject(ICustomerNavigation, PCNLicenseContract())40 verify.verifyClass(IRONContract, RONContract) 41 verify.verifyClass(ICustomerNavigation, RONContract) 42 verify.verifyObject(IRONContract, RONContract()) 43 verify.verifyObject(ICustomerNavigation, RONContract()) 44 44 return 45 45 46 46 def test_addContract(self): 47 47 container = ContractsContainer() 48 contract = createObject(u'waeup. PCNLicenseContract')48 contract = createObject(u'waeup.RONContract') 49 49 id = contract.contract_id 50 50 container.addContract(contract) 51 51 self.assertEqual(container[id], contract) 52 52 self.assertRaises(TypeError, container.addContract, object()) 53 self.assertEqual(contract.class_name, ' PCNLicenseContract')53 self.assertEqual(contract.class_name, 'RONContract') 54 54 return -
main/ikobacustom.pcn/trunk/src/ikobacustom/pcn/customers/utils.py
r12401 r12484 54 54 #'SampleContract': _('Sample Contract'), 55 55 56 ' PCNLicenseContract': _('PCN License Contract'),56 'RONContract': _('Retention Of Name'), 57 57 } 58 58 … … 65 65 'pcncustomerjpgdocuments', 66 66 'pcncustomerpdfdocuments', 67 ' pcnlicensecontracts')67 'roncontracts') -
main/ikobacustom.pcn/trunk/src/ikobacustom/pcn/utils/utils.py
r12412 r12484 68 68 'pcncustomerjpgdocuments', 69 69 'pcncustomerpdfdocuments', 70 ' pcnlicensecontracts')70 'roncontracts') 71 71 72 72 BATCH_PROCESSOR_NAMES = ( … … 74 74 'pcncustomerjpgdocumentprocessor', 75 75 'pcncustomerpdfdocumentprocessor', 76 ' pcnlicensecontractprocessor',76 'roncontractprocessor', 77 77 'pcnproductprocessor', 78 78 'pdfdocumentprocessor',
Note: See TracChangeset for help on using the changeset viewer.