Ignore:
Timestamp:
9 Jan 2010, 11:11:51 (15 years ago)
Author:
uli
Message:

Fix workflow behaviour of certificates. These are the only
'workflowed' objects yet and I have to learn more about this.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • waeup/branches/ulif-layout/src/waeup/university/certificate.py

    r4736 r4754  
    2929        self.max_pass = max_pass
    3030        # Initialize workflow state...
    31         self.setReviewState('init')
     31        self.setReviewState('unchecked')
    3232
    3333    def check(self):
     
    3939        return IWorkflowState(self).getState()
    4040
    41     def setReviewState(self, transition_id='check'):
     41    def setReviewState(self, state=None):
     42        """Try to set new state.
     43
     44        Instead of simply setting a value, we fire a transition of a
     45        workflow. This might fail if, for instance, the required state
     46        is not part of the workflow or unreachable from current state.
     47        """
     48        if state == self.getReviewState():
     49            # Accept staying in the same state, even if workflow does
     50            # not allow this.
     51            return
    4252        info = IWorkflowInfo(self)
    43         info.fireTransition(transition_id)
     53        info.fireTransitionToward(state)
    4454        return
    4555
     56    review_state = property(getReviewState, setReviewState)
     57   
    4658    def addCourseRef(self, course, level=100, core_or_elective=True):
    4759        """Add a course reference.
     
    6678        return
    6779
    68     review_state = property(getReviewState, setReviewState)
     80
    6981
    7082
Note: See TracChangeset for help on using the changeset viewer.