Changeset 6339


Ignore:
Timestamp:
10 Jun 2011, 15:41:32 (14 years ago)
Author:
uli
Message:

Maintain history of objects in a separate component, similar to workflows, instead of storing everything with the object core object.

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

Legend:

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

    r6332 r6339  
    2727from zope.schema.fieldproperty import FieldProperty
    2828from hurry.workflow.interfaces import IWorkflowInfo, IWorkflowState
    29 from waeup.sirp.interfaces import IWAeUPSIRPPluggable
     29from waeup.sirp.interfaces import IWAeUPSIRPPluggable, IObjectHistory
    3030from waeup.sirp.app import University
    3131from waeup.sirp.applicants.interfaces import (
     
    5454        state = IWorkflowState(self).getState()
    5555        return state
     56
     57    @property
     58    def history(self):
     59        history = IObjectHistory(self)
     60        return history
    5661
    5762# Set all attributes of Applicant required in IApplicant as field
  • main/waeup.sirp/trunk/src/waeup/sirp/applicants/browser_templates/form_display.pt

    r6332 r6339  
    55<h2> ... <span tal:replace="context/state">Application State</span> ... </h2>
    66
    7 <div class="workflow" tal:content="structure context/msgs">
    8   Application Workflow
     7<div class="workflow" tal:repeat="msg context/history/messages">
     8  <span tal:replace="msg">message</span><br />
    99</div>
    1010
  • main/waeup.sirp/trunk/src/waeup/sirp/applicants/browser_templates/form_edit.pt

    r6332 r6339  
    88  <h2> ... <span tal:replace="context/state">Application State</span> ... </h2>
    99
    10   <div class="workflow" tal:content="structure context/msgs">Application Workflow</div>
    11 
     10  <div class="workflow" tal:repeat="msg context/history/messages">
     11    <span tal:replace="msg">message</span><br />
     12  </div>
    1213
    1314  <div class="form-status"
  • main/waeup.sirp/trunk/src/waeup/sirp/applicants/interfaces.py

    r6337 r6339  
    283283    state, depending on use-case.
    284284    """
    285     msgs = Attribute('Workflow transitions with date of transition.')
     285    history = Attribute('Object history, a list of messages.')
    286286    state = Attribute('Returns the application state of an applicant')
    287287
     
    402402    """An applicant.
    403403
    404     Here we can repeat the fields from base data and set the `required` and
    405     `readonly` attributes to True to further restrict the data access. We cannot
    406     omit fields. This has to be done in the respective form page.
     404    Here we can repeat the fields from base data and set the
     405    `required` and `readonly` attributes to True to further restrict
     406    the data access. We cannot omit fields. This has to be done in the
     407    respective form page.
    407408    """
    408409    screening_score = schema.Int(
  • main/waeup.sirp/trunk/src/waeup/sirp/applicants/workflow.py

    r6335 r6339  
    1010    InvalidTransitionError, IWorkflowTransitionEvent)
    1111from waeup.sirp.applicants.interfaces import IApplicantBaseData
     12from waeup.sirp.interfaces import IObjectHistory
    1213
    1314
     
    172173    """
    173174    timestamp = datetime.now().strftime("%d/%m/%Y %H:%M:%S")
    174     # XXX: We should not store HTML code but simple messages.
    175175    msg = '%s - %s (new state: %s)' % (
    176176        timestamp, event.transition.user_data['msg'], event.destination)
    177     msgs = getattr(obj, 'msgs', None)
    178     if msgs:
    179         msgs += '<br />'
    180         msgs += msg
    181     else:
    182         msgs = msg
    183     obj.msgs = msgs
     177    history = IObjectHistory(obj)
     178    history.addMessage(msg)
    184179    return
Note: See TracChangeset for help on using the changeset viewer.