Changeset 7615 for main


Ignore:
Timestamp:
9 Feb 2012, 06:22:43 (13 years ago)
Author:
Henrik Bettermann
Message:

Convert function set_returning_data into utility method. This method is for demonstration purposes only. It has to be customized.

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

Legend:

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

    r7511 r7615  
    8282    return sid
    8383
    84 def set_returning_data(student):
    85     student['studycourse'].current_level += 100
    86     student['studycourse'].current_session += 1
    87     verdict = student['studycourse'].current_verdict
    88     student['studycourse'].current_verdict = '0'
    89     student['studycourse'].previous_verdict = verdict
    90     return
    91 
    9284def set_up_widgets(view, ignore_request=False):
    9385    view.adapters = {}
     
    172164    grok.implements(IStudentsUtils)
    173165
    174     def getPaymentDetails(self,category, student):
     166    def setReturningData(self, student):
     167        student['studycourse'].current_level += 100
     168        student['studycourse'].current_session += 1
     169        verdict = student['studycourse'].current_verdict
     170        student['studycourse'].current_verdict = '0'
     171        student['studycourse'].previous_verdict = verdict
     172        return
     173
     174    def getPaymentDetails(self, category, student):
    175175        d = {}
    176176        d['p_item'] = u''
  • main/waeup.sirp/trunk/src/waeup/sirp/students/workflow.py

    r7535 r7615  
    22"""
    33import grok
     4from zope.component import getUtility
    45from hurry.workflow.workflow import Transition, WorkflowState, NullCondition
    56from hurry.workflow.interfaces import IWorkflowState, IWorkflowTransitionEvent
    67from waeup.sirp.interfaces import (
    7     IObjectHistory, ISIRPWorkflowInfo,
     8    IObjectHistory, ISIRPWorkflowInfo, 
    89    CREATED, ADMITTED, CLEARANCE, REQUESTED, CLEARED, PAID, RETURNING,
    910    REGISTERED, VALIDATED)
    1011from waeup.sirp.workflow import SIRPWorkflow, SIRPWorkflowInfo
    1112from waeup.sirp.utils.helpers import get_current_principal
    12 from waeup.sirp.students.interfaces import IStudent
    13 from waeup.sirp.students.utils import set_returning_data
     13from waeup.sirp.students.interfaces import IStudent, IStudentsUtils
     14
    1415
    1516IMPORTABLE_STATES = (ADMITTED, CLEARANCE, REQUESTED, CLEARED, PAID, RETURNING,
     
    195196    # current session, current level, and current verdict
    196197    if event.transition.transition_id == 'pay_school_fee':
    197         set_returning_data(obj)
     198        getUtility(IStudentsUtils).setReturningData(obj)
    198199    # In some tests we don't have a students container or a user
    199200    try:
Note: See TracChangeset for help on using the changeset viewer.