Ignore:
Timestamp:
21 Dec 2014, 07:46:55 (10 years ago)
Author:
Henrik Bettermann
Message:

Reorganize exporters slightly to ease customization.

File:
1 edited

Legend:

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

    r12168 r12275  
    128128    grok.name('customers')
    129129
    130     #: Fieldnames considered by this exporter
    131     fields = tuple(sorted(iface_names(ICustomer))) + (
    132         'password', 'state', 'history',)
     130    iface = ICustomer
    133131
    134132    #: The title under which this exporter will be displayed
    135133    title = _(u'Customers')
     134
     135    #: Fieldnames considered by this exporter
     136    @property
     137    def fields(self):
     138        return tuple(sorted(iface_names(self.iface))) + (
     139            'password', 'state', 'history',)
    136140
    137141    def mangle_value(self, value, name, context=None):
     
    152156    grok.name('customerdocuments')
    153157
    154     #: Fieldnames considered by this exporter
    155     fields = tuple(
    156         sorted(iface_names(
    157             ICustomerDocument,
    158             exclude_attribs=False,
    159             omit=['is_editable_by_customer',
    160                   'is_editable_by_manager',
    161                   'is_verifiable',
    162                   'translated_state',
    163                   'formatted_transition_date',
    164                   'translated_class_name',
    165                   'connected_files',   # Could be used to export file URLs
    166                   ])))
     158    iface = ICustomerDocument
    167159
    168160    #: The title under which this exporter will be displayed
    169161    title = _(u'Customer Documents')
     162
     163    #: Fieldnames considered by this exporter
     164    @property
     165    def fields(self):
     166        return tuple(
     167            sorted(iface_names(
     168                self.iface, exclude_attribs=False,
     169                omit=['is_editable_by_customer',
     170                      'is_editable_by_manager',
     171                      'is_verifiable',
     172                      'translated_state',
     173                      'formatted_transition_date',
     174                      'translated_class_name',
     175                      'connected_files',   # Could be used to export file URLs
     176                      ])))
    170177
    171178    def filter_func(self, x, **kw):
     
    186193    grok.name('contracts')
    187194
    188     #: Fieldnames considered by this exporter
    189     fields = tuple(
    190         sorted(iface_names(
    191             ISampleContract,
    192             exclude_attribs=False,
    193             omit=['translated_state',
    194                   'formatted_transition_date',
    195                   'translated_class_name',
    196                   'is_editable_by_customer',
    197                   'is_approvable'])))
     195    iface = ISampleContract
    198196
    199197    #: The title under which this exporter will be displayed
    200198    title = _(u'Contracts')
     199
     200    #: Fieldnames considered by this exporter
     201    @property
     202    def fields(self):
     203        return tuple(
     204            sorted(iface_names(
     205                self.iface, exclude_attribs=False,
     206                omit=['translated_state',
     207                      'formatted_transition_date',
     208                      'translated_class_name',
     209                      'is_editable_by_customer',
     210                      'is_approvable'])))
    201211
    202212    def filter_func(self, x, **kw):
Note: See TracChangeset for help on using the changeset viewer.