Changeset 9025


Ignore:
Timestamp:
19 Jul 2012, 20:30:20 (12 years ago)
Author:
Henrik Bettermann
Message:

Print zope schema field name in brackets.

The third row can be used for copy and paste the csv header into a csv file.

Location:
main/waeup.kofa/trunk/src/waeup/kofa/browser
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • main/waeup.kofa/trunk/src/waeup/kofa/browser/pages.py

    r9024 r9025  
    878878    def getImporters(self):
    879879        importers = getAllUtilitiesRegisteredFor(IBatchProcessor)
    880         importers = sorted(
    881             [dict(title=x.name, name=x.util_name, fields=x.available_fields)
    882             for x in importers], key=lambda k: k['title'])
    883         return importers
     880        importer_props = []
     881        for x in importers:
     882            iface_fields = schema.getFields(x.iface)
     883            available_fields = []
     884            for key in iface_fields.keys():
     885                iface_fields[key] = iface_fields[key].__class__.__name__
     886            for value in x.available_fields:
     887                available_fields.append(
     888                    dict(f_name=value,
     889                         f_type=iface_fields.get(value, 'None')))
     890            available_fields = sorted(available_fields, key=lambda k: k['f_name'])
     891            importer_props.append(
     892                dict(title=x.name, name=x.util_name, fields=available_fields))
     893        return sorted(importer_props, key=lambda k: k['title'])
    884894
    885895class FileDownloadView(UtilityView, grok.View):
  • main/waeup.kofa/trunk/src/waeup/kofa/browser/templates/datacenteruploadpage.pt

    r9024 r9025  
    1919      <th i18n:translate="">Processor</th>
    2020      <th i18n:translate="">Available Fields</th>
     21      <th i18n:translate="">CSV File Header</th>
    2122    </tr>
    2223  </thead>
     
    2425    <td tal:content="importer/title"></td>
    2526    <td>
    26         <span tal:repeat="field python:sorted(importer['fields'])">
    27             <span tal:replace="field"></span>,
     27        <span tal:repeat="field importer/fields">
     28            <span tal:replace="field/f_name"></span>
     29            (<span tal:replace="field/f_type"></span>),
     30        </span>
     31    </td>
     32    <td>
     33        <span tal:repeat="field importer/fields">
     34            <span tal:replace="field/f_name"></span>,
    2835        </span>
    2936    </td>
Note: See TracChangeset for help on using the changeset viewer.