Ignore:
Timestamp:
7 Jun 2011, 12:16:27 (13 years ago)
Author:
Henrik Bettermann
Message:

Move workflow methods from certificates to applicants.

Location:
main/waeup.sirp/trunk/src/waeup/sirp/applicants
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • main/waeup.sirp/trunk/src/waeup/sirp/applicants/applicants.py

    r6198 r6296  
    2525from zope.interface import implementedBy
    2626from zope.schema.fieldproperty import FieldProperty
     27from hurry.workflow.interfaces import IWorkflowInfo, IWorkflowState
    2728from waeup.sirp.interfaces import IWAeUPSIRPPluggable
    2829from waeup.sirp.app import University
     
    4344    grok.implements(IApplicant,IApplicantEdit)
    4445    grok.provides(IApplicant)
     46
     47    def __init__(self):
     48        super(Applicant, self).__init__()
     49        #Initialize workflow state...
     50        self.setApplicationState('initialized')
     51
     52    def getApplicationState(self):
     53        return IWorkflowState(self).getState()
     54
     55    def setApplicationState(self, state=None):
     56        """Try to set new state.
     57
     58        Instead of simply setting a value, we fire a transition of a
     59        workflow. This might fail if, for instance, the required state
     60        is not part of the workflow or unreachable from current state.
     61        """
     62        if state == self.getApplicationState():
     63            # Accept staying in the same state, even if workflow does
     64            # not allow this.
     65            return
     66        info = IWorkflowInfo(self)
     67        info.fireTransitionToward(state)
     68        return
     69
     70    #application_state = property(getApplicationState, setApplicationState)
    4571
    4672# Set all attributes of Applicant required in IApplicant as field
  • main/waeup.sirp/trunk/src/waeup/sirp/applicants/interfaces.py

    r6290 r6296  
    291291        #readonly = True,
    292292        )
     293
    293294    reg_no = schema.TextLine(
    294295        title = u'JAMB Registration Number',
     
    366367        readonly = True,
    367368        )
    368     status = schema.TextLine(
    369         # XXX: should be 'status' type
    370         title = u'Application Status',
    371         required = False,
    372         readonly = True,
    373         )
     369
     370    #application_state = schema.Choice(
     371    #    title = u'Application Status',
     372    #    default = 'created',
     373    #    values = ['unchecked', 'checked']
     374    #    readonly = True,
     375    #    )
     376
    374377    screening_score = schema.Int(
    375378        title = u'Screening Score',
Note: See TracChangeset for help on using the changeset viewer.