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

Reuse workflow.py for applicants.

File:
1 edited

Legend:

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

    r4920 r6294  
    1 """Workflows used in the WAeUP SRP portal.
     1"""Workflow for applicants.
    22"""
    33import grok
     
    77from hurry.workflow.interfaces import IWorkflow, IWorkflowState, IWorkflowInfo
    88from hurry.workflow.interfaces import IWorkflowVersions
    9 from waeup.sirp.interfaces import IWAeUPObject
     9from waeup.sirp.applicants.interfaces import IApplicantBaseData
    1010
    11 UNCHECKED = 'unchecked'
    12 CHECKED = 'checked'
     11INITIALIZED = 'initialized'
     12STARTED = 'started'
     13SUBMITTED = 'submitted'
     14ADMITTED = 'admitted'
     15NOT_ADMITTED = 'not admitted'
     16CREATED = 'created'
    1317
    1418def create_workflow():
     
    1822        source = None,
    1923        condition = NullCondition,
    20         destination = UNCHECKED)
     24        destination = INITIALIZED)
    2125
    22     check_transition = Transition(
    23         transition_id = 'check',
    24         title = 'Check',
    25         source = UNCHECKED,
    26         destination = CHECKED)
     26    start_transition = Transition(
     27        transition_id = 'start',
     28        title = 'Start',
     29        source = INITIALIZED,
     30        destination = STARTED)
    2731
    28     final_transition = Transition(
    29         transition_id = 'finalize',
    30         title = 'Delete',
    31         source = CHECKED,
    32         destination = None)
     32    submit_transition = Transition(
     33        transition_id = 'submit',
     34        title = 'Submit',
     35        source = STARTED,
     36        destination = SUBMITTED)
    3337
    34     return [init_transition, check_transition, final_transition]
     38    admit_transition = Transition(
     39        transition_id = 'admit',
     40        title = 'Admit',
     41        source = SUBMITTED,
     42        destination = ADMITTED)
     43
     44    defer_transition = Transition(
     45        transition_id = 'defer',
     46        title = 'Defer',
     47        source = SUBMITTED,
     48        destination = NOT_ADMITTED)
     49
     50    create_transition = Transition(
     51        transition_id = 'create',
     52        title = 'Create Student',
     53        source = ADMITTED,
     54        destination = CREATED)
     55
     56    #final_transition = Transition(
     57    #    transition_id = 'finalize',
     58    #    title = 'Delete',
     59    #    source = ADMITTED,
     60    #    destination = None)
     61
     62    return [init_transition, start_transition, submit_transition, admit_transition,
     63        defer_transition, create_transition,]
    3564
    3665
    37 class WAeUPWorkflow(Workflow):
     66class ApplicationWorkflow(Workflow):
    3867    """A hurry.workflow Workflow with more appropriate error messages.
    3968    """
     
    5584
    5685
    57 class WorkflowNullVersions(WorkflowVersions):
     86class ApplicationWorkflowNullVersions(WorkflowVersions):
    5887    """A workflow versions manager that does not handle versions.
    5988
     
    85114
    86115# Register global utilities for workflows and workflow versions...
    87 grok.global_utility(WAeUPWorkflow, IWorkflow)
    88 grok.global_utility(WorkflowNullVersions, IWorkflowVersions)
     116grok.global_utility(ApplicationWorkflow, IWorkflow)
     117grok.global_utility(ApplicationWorkflowNullVersions, IWorkflowVersions)
    89118
    90119class WorkflowState(grok.Adapter, WorkflowState):
    91     """An adapter to adapt WAeUP objects to workflow states.
     120    """An adapter to adapt Applicant objects to workflow states.
    92121    """
    93     grok.context(IWAeUPObject)
     122    grok.context(IApplicantBaseData)
    94123    grok.provides(IWorkflowState)
    95124   
    96125class WorkflowInfo(grok.Adapter, WorkflowInfo):
    97     """Adapter to adapt WAeUP objects to workflow info objects.
     126    """Adapter to adapt Applicant objects to workflow info objects.
    98127    """
    99     grok.context(IWAeUPObject)
     128    grok.context(IApplicantBaseData)
    100129    grok.provides(IWorkflowInfo)
Note: See TracChangeset for help on using the changeset viewer.