Ignore:
Timestamp:
19 Dec 2014, 08:11:12 (10 years ago)
Author:
Henrik Bettermann
Message:

Validate document and contract ids properly.

Location:
main/waeup.ikoba/trunk/src/waeup/ikoba/customers
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • main/waeup.ikoba/trunk/src/waeup/ikoba/customers/interfaces.py

    r12258 r12260  
    2323from waeup.ikoba.interfaces import MessageFactory as _
    2424from waeup.ikoba.interfaces import (
    25     IIkobaObject, validate_email, ICSVExporter)
     25    IIkobaObject, validate_email, ICSVExporter, validate_uuid)
    2626from waeup.ikoba.schema import TextLineChoice, FormattedDate, PhoneNumber
    2727from waeup.ikoba.browser.interfaces import ICustomerNavigationBase
     
    128128        constraint=validate_email,
    129129        )
     130
    130131    phone = PhoneNumber(
    131132        title = _(u'Phone'),
     
    243244    is_editable_by_manager = Attribute('Document editable by manager')
    244245
    245 
    246 class ICustomerPDFDocument(IDocument):
     246    document_id = schema.TextLine(
     247        title = _(u'Document Id'),
     248        required = False,
     249        constraint=validate_uuid,
     250        )
     251
     252
     253class ICustomerPDFDocument(ICustomerDocument):
    247254    """A customer document.
    248255
     
    282289        title = _(u'Contract Id'),
    283290        required = False,
     291        constraint=validate_uuid,
    284292        )
    285293
  • main/waeup.ikoba/trunk/src/waeup/ikoba/customers/tests/test_batching.py

    r12259 r12260  
    337337            dict(document_id='DOC', class_name='CustomerSampleDocument'))
    338338        self.assertEqual(len(errs),0)
    339         #errs, inv_errs, conv_dict = self.processor.checkConversion(
    340         #    dict(document_id='id with spaces', class_name='CustomerSampleDocument'))
    341         #self.assertEqual(len(errs),1)
     339        errs, inv_errs, conv_dict = self.processor.checkConversion(
     340            dict(document_id='id with spaces', class_name='CustomerSampleDocument'))
     341        self.assertEqual(len(errs),1)
    342342        errs, inv_errs, conv_dict = self.processor.checkConversion(
    343343            dict(document_id='DOC', class_name='WrongDocument'))
     
    468468                 document_object='DOC1', product_object='SAM'))
    469469        self.assertEqual(len(errs),0)
    470         #errs, inv_errs, conv_dict = self.processor.checkConversion(
    471         #    dict(contract_id='id with spaces', class_name='SampleContract'))
    472         #self.assertEqual(len(errs),1)
     470        errs, inv_errs, conv_dict = self.processor.checkConversion(
     471            dict(contract_id='id with spaces', class_name='SampleContract'))
     472        self.assertEqual(len(errs),1)
    473473        errs, inv_errs, conv_dict = self.processor.checkConversion(
    474474            dict(contract_id='CON3', class_name='WrongContract'))
Note: See TracChangeset for help on using the changeset viewer.