Ignore:
Timestamp:
18 Nov 2014, 09:17:13 (10 years ago)
Author:
Henrik Bettermann
Message:

Add history attribute and test history.

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

    r11982 r11983  
    2828from zope.interface import implementedBy
    2929from zope.i18n import translate
    30 from waeup.ikoba.interfaces import IIkobaUtils
     30from waeup.ikoba.interfaces import IIkobaUtils, IObjectHistory
    3131from waeup.ikoba.interfaces import MessageFactory as _
    3232from waeup.ikoba.documents.interfaces import IDocument, IDocument
     
    5656        return
    5757
     58    @property
     59    def history(self):
     60        history = IObjectHistory(self)
     61        return history
     62
    5863Document = attrs_to_fields(Document)
    5964
  • main/waeup.ikoba/trunk/src/waeup/ikoba/documents/interfaces.py

    r11982 r11983  
    2424
    2525class DocumentCategorySource(ContextualDictSourceFactoryBase):
    26     """A document category source delivers all categories of documents.
     26    """A document type source delivers all types of documents.
    2727
    2828    """
    2929    #: name of dict to deliver from ikoba utils.
    30     DICT_NAME = 'DOCUMENT_CATEGORIES'
     30    DICT_NAME = 'DOCUMENT_TYPES'
    3131
    3232class IDocumentsContainer(IIkobaObject):
     
    4040    """
    4141    id = Attribute('Document Identifier')
     42    history = Attribute('Object history, a list of messages')
    4243
    4344    category = schema.Choice(
     
    4748        )
    4849
     50    title = schema.TextLine(
     51        title = _(u'Document Title'),
     52        required = True,
     53        )
    4954
     55
  • main/waeup.ikoba/trunk/src/waeup/ikoba/documents/tests.py

    r11982 r11983  
    2525from waeup.ikoba.documents.interfaces import (
    2626    IDocumentsContainer, IDocument)
     27from waeup.ikoba.interfaces import IObjectHistory
    2728from waeup.ikoba.documents.container import DocumentsContainer
    2829from waeup.ikoba.documents.document import Document
     
    7879        self.assertEqual(IWorkflowState(document).getState(), 'created')
    7980        return
     81
     82    def test_document_history(self):
     83        doc = createObject(u'waeup.Document')
     84        IWorkflowInfo(doc).fireTransition('create')
     85        messages = ' '.join(doc.history.messages)
     86        self.assertTrue('Document created by system' in messages)
     87        return
Note: See TracChangeset for help on using the changeset viewer.