Ignore:
Timestamp:
21 Nov 2014, 18:52:43 (10 years ago)
Author:
Henrik Bettermann
Message:

Implement translated_state property correctly so that we can more easily customized customer registration and document verification state names.

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

Legend:

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

    r12005 r12032  
    3636from waeup.ikoba.interfaces import (
    3737    IObjectHistory, IUserAccount, IFileStoreNameChooser, IFileStoreHandler,
    38     IIkobaUtils, registration_states_vocab, IExtFileStore,
     38    IIkobaUtils, IExtFileStore,
    3939    CREATED, REQUESTED, APPROVED)
    4040from waeup.ikoba.customers.export import EXPORTER_NAMES
    4141from waeup.ikoba.customers.interfaces import (
    42     ICustomer, ICustomerNavigation, ICSVCustomerExporter)
     42    ICustomer, ICustomerNavigation, ICSVCustomerExporter,
     43    ICustomersUtils)
    4344from waeup.ikoba.customers.utils import generate_customer_id
    4445from waeup.ikoba.customers.documents import CustomerDocumentsContainer
     
    126127    @property
    127128    def translated_state(self):
    128         state = registration_states_vocab.getTermByToken(
    129             self.state).title
    130         return state
     129        try:
     130            TRANSLATED_STATES = getUtility(ICustomersUtils).TRANSLATED_STATES
     131            ts = TRANSLATED_STATES[self.state]
     132            return ts
     133        except KeyError:
     134            return
    131135
    132136    @property
  • main/waeup.ikoba/trunk/src/waeup/ikoba/customers/export.py

    r12018 r12032  
    2323from zope.component import getUtility
    2424from waeup.ikoba.interfaces import (
    25     IExtFileStore, IFileStoreNameChooser, IIkobaUtils)
     25    IExtFileStore, IFileStoreNameChooser)
    2626from waeup.ikoba.interfaces import MessageFactory as _
    2727from waeup.ikoba.customers.catalog import CustomersQuery
     
    147147            ICustomerDocument,
    148148            exclude_attribs=False,
    149             omit=['is_editable']))) + (
     149            omit=['is_editable', 'translated_state']))) + (
    150150            'customer_id',)
    151151
  • main/waeup.ikoba/trunk/src/waeup/ikoba/customers/utils.py

    r12018 r12032  
    1919"""
    2020import grok
    21 from waeup.ikoba.interfaces import STARTED, APPROVED
     21from waeup.ikoba.interfaces import MessageFactory as _
     22from waeup.ikoba.interfaces import CREATED, STARTED, REQUESTED, APPROVED
    2223from waeup.ikoba.customers.interfaces import ICustomersUtils
    2324
     
    4142
    4243    DOCMANAGE_STATES = (APPROVED,)
     44
     45    TRANSLATED_STATES = {
     46        CREATED: _('created'),
     47        STARTED: _('started'),
     48        REQUESTED: _('requested'),
     49        APPROVED: _('approved'),
     50        }
Note: See TracChangeset for help on using the changeset viewer.