Changeset 12056 for main


Ignore:
Timestamp:
25 Nov 2014, 11:44:47 (10 years ago)
Author:
Henrik Bettermann
Message:

Replace classname by class_name (see Passig & Jander).

Location:
main/waeup.ikoba/trunk/src/waeup/ikoba
Files:
13 edited

Legend:

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

    r12054 r12056  
    379379
    380380    location_fields = []
    381     additional_fields = ['document_id', 'classname']
    382     additional_headers = ['classname']
     381    additional_fields = ['document_id', 'class_name']
     382    additional_headers = ['class_name']
    383383
    384384    def checkHeaders(self, headerfields, mode='ignore'):
     
    437437        errs, inv_errs, conv_dict = super(
    438438            CustomerDocumentProcessor, self).checkConversion(row, mode=mode)
    439         # We need to check if the classname corresponds with the
     439        # We need to check if the class_name corresponds with the
    440440        # processor chosen. This is to avoid accidentally wrong imports.
    441441        if mode != 'remove':
    442             classname = row.get('classname', None)
    443             if classname != self.factory_name.strip('waeup.'):
    444                 errs.append(('classname','wrong processor'))
     442            class_name = row.get('class_name', None)
     443            if class_name != self.factory_name.strip('waeup.'):
     444                errs.append(('class_name','wrong processor'))
    445445        # We have to check document_id.
    446446        document_id = row.get('document_id', None)
  • main/waeup.ikoba/trunk/src/waeup/ikoba/customers/browser.py

    r12055 r12056  
    975975            tableheader.append([(Id, 'document_id', 2),
    976976                             (Title, 'title', 6),
    977                              (Type, 'translated_classname', 6),
     977                             (Type, 'translated_class_name', 6),
    978978                             (State, 'translated_state', 2),
    979979                             (LT, 'formatted_transition_date', 3),
  • main/waeup.ikoba/trunk/src/waeup/ikoba/customers/browser_templates/documentpage.pt

    r12035 r12056  
    1313  tal:define="files provider:files">
    1414  <tbody>
     15    <tr>
     16      <td i18n:translate="" class="fieldname">
     17        Document Type:
     18      </td>
     19      <td>
     20        <span tal:content="context/translated_class_name">CLASSNAME</span>
     21      </td>
     22    </tr>
    1523    <tal:widgets content="structure provider:widgets" />
    1624    <tr tal:condition="python: files.replace('\n','')">
  • main/waeup.ikoba/trunk/src/waeup/ikoba/customers/browser_templates/documentsmanagepage.pt

    r12055 r12056  
    2929        </td>
    3030        <td>
    31           <span tal:content="cl/translated_classname">CLASSNAME</span>
     31          <span tal:content="cl/translated_class_name">CLASSNAME</span>
    3232        </td>
    3333        <td>
  • main/waeup.ikoba/trunk/src/waeup/ikoba/customers/documents.py

    r12053 r12056  
    9595
    9696    @property
    97     def translated_classname(self):
     97    def translated_class_name(self):
    9898        try:
    9999            DOCTYPES_DICT = getUtility(ICustomersUtils).DOCTYPES_DICT
    100             return DOCTYPES_DICT[self.classname]
     100            return DOCTYPES_DICT[self.class_name]
    101101        except KeyError:
    102102            return
  • main/waeup.ikoba/trunk/src/waeup/ikoba/customers/export.py

    r12053 r12056  
    150150                  'translated_state',
    151151                  'formatted_transition_date',
    152                   'translated_classname']))) + (
     152                  'translated_class_name']))) + (
    153153            'customer_id',)
    154154
  • main/waeup.ikoba/trunk/src/waeup/ikoba/customers/interfaces.py

    r12053 r12056  
    270270
    271271    is_editable = Attribute('Document editable by customer')
    272     translated_classname = Attribute('Translatable classname')
     272    translated_class_name = Attribute('Translatable class name')
    273273
    274274
  • main/waeup.ikoba/trunk/src/waeup/ikoba/customers/tests/sample_document_data.csv

    r12054 r12056  
    1 classname,document_id,reg_number,title
     1class_name,document_id,reg_number,title
    22CustomerDocument,d3,1,My first doc
    33CustomerDocument,d4,2,My second doc
  • main/waeup.ikoba/trunk/src/waeup/ikoba/customers/tests/test_batching.py

    r12054 r12056  
    318318    def test_checkConversion(self):
    319319        errs, inv_errs, conv_dict = self.processor.checkConversion(
    320             dict(document_id='d1266236341955', classname='CustomerDocument'))
     320            dict(document_id='d1266236341955', class_name='CustomerDocument'))
    321321        self.assertEqual(len(errs),0)
    322322        errs, inv_errs, conv_dict = self.processor.checkConversion(
    323             dict(document_id='nonsense', classname='CustomerDocument'))
     323            dict(document_id='nonsense', class_name='CustomerDocument'))
    324324        self.assertEqual(len(errs),1)
    325325        timestamp = ("%d" % int(time()*10000))[1:]
    326326        document_id = "d%s" % timestamp
    327327        errs, inv_errs, conv_dict = self.processor.checkConversion(
    328             dict(document_id=document_id, classname='CustomerDocument'))
     328            dict(document_id=document_id, class_name='CustomerDocument'))
    329329        self.assertEqual(len(errs),0)
    330330        errs, inv_errs, conv_dict = self.processor.checkConversion(
    331             dict(document_id=document_id, classname='WrongDocument'))
     331            dict(document_id=document_id, class_name='WrongDocument'))
    332332        self.assertEqual(len(errs),1)
    333333
     
    339339        fail_file = open(fail_file).read()
    340340        self.assertEqual(fail_file,
    341             'classname,reg_number,document_id,title,--ERRORS--\r\n'
     341            'class_name,reg_number,document_id,title,--ERRORS--\r\n'
    342342            'CustomerDocument,2,d5,My stolen doc,document_id: id exists\r\n')
    343343        document = self.processor.getEntry(dict(reg_number='1',
  • main/waeup.ikoba/trunk/src/waeup/ikoba/customers/tests/test_document.py

    r12053 r12056  
    6161        self.assertEqual(container[id], document)
    6262        self.assertRaises(TypeError, container.addDocument, object())
    63         self.assertEqual(document.classname, 'CustomerDocument')
     63        self.assertEqual(document.class_name, 'CustomerDocument')
    6464        return
    6565
  • main/waeup.ikoba/trunk/src/waeup/ikoba/customers/tests/test_export.py

    r12053 r12056  
    138138        self.assertEqual(
    139139            result,
    140             'classname,document_id,history,last_transition_date,state,title,customer_id\r\n'
     140            'class_name,document_id,history,last_transition_date,state,title,customer_id\r\n'
    141141            'CustomerDocument,d101,[],,,,\r\n'
    142142            )
     
    152152        result = open(self.outfile, 'rb').read()
    153153        self.assertTrue(
    154             'classname,document_id,history,last_transition_date,state,title,customer_id\r\n'
     154            'class_name,document_id,history,last_transition_date,state,title,customer_id\r\n'
    155155            in result
    156156            )
     
    171171        result = open(self.outfile, 'rb').read()
    172172        self.assertTrue(
    173             'classname,document_id,history,last_transition_date,state,title,customer_id\r\n'
     173            'class_name,document_id,history,last_transition_date,state,title,customer_id\r\n'
    174174            in result)
    175175        self.assertMatches(
     
    189189        result = open(self.outfile, 'rb').read()
    190190        self.assertTrue(
    191             'classname,document_id,history,last_transition_date,state,title,customer_id\r\n'
     191            'class_name,document_id,history,last_transition_date,state,title,customer_id\r\n'
    192192            in result)
    193193        self.assertMatches(
  • main/waeup.ikoba/trunk/src/waeup/ikoba/documents/document.py

    r12053 r12056  
    8181
    8282    @property
    83     def classname(self):
     83    def class_name(self):
    8484        return self.__class__.__name__
    8585
  • main/waeup.ikoba/trunk/src/waeup/ikoba/documents/interfaces.py

    r12053 r12056  
    4949    translated_state = Attribute(
    5050        'Returns a translated, more verbose verification state of a document')
    51     classname = Attribute('Name of the document class')
     51    class_name = Attribute('Name of the document class')
    5252    formatted_transition_date = Attribute('Last transition formatted date string')
    5353
Note: See TracChangeset for help on using the changeset viewer.