Ignore:
Timestamp:
8 Dec 2014, 06:17:30 (10 years ago)
Author:
Henrik Bettermann
Message:

Documents can't be verified without file(s) attached.

Let is_approvable and is_verifiable be more verbose.

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

    r12161 r12168  
    8787        return
    8888
     89    @property
     90    def is_verifiable(self):
     91        return True, None
     92
    8993    def setMD5(self):
    9094        """Determine md5 checksum of all files and store checksums as
  • main/waeup.ikoba/trunk/src/waeup/ikoba/documents/interfaces.py

    r12161 r12168  
    5353    user_id = Attribute('Id of a user')
    5454    connected_files = Attribute('Names of files connected to a document')
     55    is_verifiable = Attribute('Contract verifiable by officer')
    5556
    5657    title = schema.TextLine(
  • main/waeup.ikoba/trunk/src/waeup/ikoba/documents/workflow.py

    r12162 r12168  
    2222from zope.component import getUtility
    2323from hurry.workflow.workflow import Transition, WorkflowState, NullCondition
    24 from hurry.workflow.interfaces import IWorkflowState, IWorkflowTransitionEvent
     24from hurry.workflow.interfaces import (
     25    IWorkflowState, IWorkflowTransitionEvent, InvalidTransitionError)
    2526from waeup.ikoba.interfaces import (
    2627    IObjectHistory, IIkobaWorkflowInfo,
     
    128129    """Append message to document history and log file and update
    129130    last_transition_date when transition happened.
     131
     132    Undo the verification of document and raise an exception if document
     133    does not meet the requirements for verification.
    130134    """
     135    if event.transition.destination == VERIFIED:
     136        verifiable, error = obj.is_verifiable
     137        if not verifiable:
     138            # Undo transition and raise an exception.
     139            IWorkflowState(obj).setState(event.transition.source)
     140            raise InvalidTransitionError(error)
    131141    if event.transition.transition_id == 'verify':
    132142        obj.setMD5()
Note: See TracChangeset for help on using the changeset viewer.