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/documents
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • main/waeup.ikoba/trunk/src/waeup/ikoba/documents/document.py

    r12017 r12032  
    3232from waeup.ikoba.utils.helpers import attrs_to_fields, get_current_principal
    3333from waeup.ikoba.utils.logger import Logger
    34 from waeup.ikoba.documents.interfaces import IDocument, IDocument
     34from waeup.ikoba.documents.interfaces import (
     35    IDocument, IDocument, IDocumentsUtils)
    3536from waeup.ikoba.documents.utils import generate_document_id
    3637
     
    5253        return
    5354
    54     #def __init__(self):
    55     #    super(Document, self).__init__()
    56     #    timestamp = ("%d" % int(time()*10000))[1:]
    57     #    self.document_id = "d%s" % timestamp
    58      #   return
    59 
    6055    def __init__(self):
    6156        super(Document, self).__init__()
     
    7671        state = IWorkflowState(self).getState()
    7772        return state
     73
     74    @property
     75    def translated_state(self):
     76        try:
     77            TRANSLATED_STATES = getUtility(IDocumentsUtils).TRANSLATED_STATES
     78            ts = TRANSLATED_STATES[self.state]
     79            return ts
     80        except KeyError:
     81            return
    7882
    7983Document = attrs_to_fields(Document)
  • main/waeup.ikoba/trunk/src/waeup/ikoba/documents/interfaces.py

    r12018 r12032  
    1919from zope import schema
    2020from waeup.ikoba.interfaces import (
    21     IIkobaObject, SimpleIkobaVocabulary,
     21    IIkobaObject,
    2222    ContextualDictSourceFactoryBase)
    2323from waeup.ikoba.interfaces import MessageFactory as _
     24
    2425
    2526class DocumentTypeSource(ContextualDictSourceFactoryBase):
     
    4647    history = Attribute('Object history, a list of messages')
    4748    state = Attribute('Returns the verification state of a document')
     49    translated_state = Attribute(
     50        'Returns a translated, more verbose verification state of a document')
    4851
    4952    title = schema.TextLine(
  • main/waeup.ikoba/trunk/src/waeup/ikoba/documents/utils.py

    r12018 r12032  
    1919"""
    2020import grok
     21from waeup.ikoba.interfaces import MessageFactory as _
    2122from waeup.ikoba.documents.workflow import CREATED
    2223from waeup.ikoba.documents.interfaces import IDocumentsUtils
     24from waeup.ikoba.documents.workflow import (
     25    CREATED, SUBMITTED,
     26    VERIFIED, REJECTED, OUTDATED)
    2327
    2428
     
    3438
    3539    DOCMANAGE_STATES = (CREATED,)
     40
     41    TRANSLATED_STATES = {
     42        CREATED: _('document created'),
     43        SUBMITTED: _('document submitted'),
     44        VERIFIED: _('document verified'),
     45        REJECTED: _('document rejected'),
     46        OUTDATED:_('document outdated')
     47        }
  • main/waeup.ikoba/trunk/src/waeup/ikoba/documents/workflow.py

    r12015 r12032  
    2424from hurry.workflow.interfaces import IWorkflowState, IWorkflowTransitionEvent
    2525from waeup.ikoba.interfaces import (
    26     IObjectHistory, IIkobaWorkflowInfo, IIkobaUtils)
     26    IObjectHistory, IIkobaWorkflowInfo,
     27    SimpleIkobaVocabulary)
    2728from waeup.ikoba.interfaces import MessageFactory as _
    2829from waeup.ikoba.workflow import IkobaWorkflow, IkobaWorkflowInfo
Note: See TracChangeset for help on using the changeset viewer.