Ignore:
Timestamp:
25 Nov 2014, 08:19:54 (10 years ago)
Author:
Henrik Bettermann
Message:

Add second customer document class.
Select document factory when adding documents.
Add last_transition_date attribute and further property attributes to documents.

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

Legend:

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

    r12032 r12053  
    7676        try:
    7777            TRANSLATED_STATES = getUtility(IDocumentsUtils).TRANSLATED_STATES
    78             ts = TRANSLATED_STATES[self.state]
    79             return ts
     78            return TRANSLATED_STATES[self.state]
    8079        except KeyError:
    8180            return
     81
     82    @property
     83    def classname(self):
     84        return self.__class__.__name__
     85
     86    @property
     87    def formatted_transition_date(self):
     88        try:
     89            return self.last_transition_date.strftime('%Y-%m-%d %H:%M:%S')
     90        except AttributeError:
     91            return
     92       
    8293
    8394Document = attrs_to_fields(Document)
  • main/waeup.ikoba/trunk/src/waeup/ikoba/documents/interfaces.py

    r12032 r12053  
    4949    translated_state = Attribute(
    5050        'Returns a translated, more verbose verification state of a document')
     51    classname = Attribute('Name of the document class')
     52    formatted_transition_date = Attribute('Last transition formatted date string')
    5153
    5254    title = schema.TextLine(
     
    5557        )
    5658
     59    last_transition_date = schema.Datetime(
     60        title = _(u'Last Transition Date'),
     61        required = False,
     62        readonly = False,
     63        )
     64
     65
    5766class IDocumentsUtils(Interface):
    5867    """A collection of methods which are subject to customization.
  • main/waeup.ikoba/trunk/src/waeup/ikoba/documents/workflow.py

    r12032 r12053  
    124124@grok.subscribe(IDocument, IWorkflowTransitionEvent)
    125125def handle_document_transition_event(obj, event):
    126     """Append message to document history and log file when transition happened.
     126    """Append message to document history and log file and update
     127    last_transition_date when transition happened.
    127128    """
    128129    msg = event.transition.user_data['msg']
    129130    history = IObjectHistory(obj)
    130131    history.addMessage(msg)
     132    obj.last_transition_date = datetime.utcnow()
    131133    try:
    132134        customers_container = grok.getSite()['customers']
Note: See TracChangeset for help on using the changeset viewer.