Changeset 6318 for main/waeup.sirp/trunk/src
- Timestamp:
- 10 Jun 2011, 01:51:30 (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.sirp/trunk/src/waeup/sirp/applicants/workflow.py
r6316 r6318 2 2 """ 3 3 import grok 4 from datetime import datetime 4 5 from hurry.workflow.workflow import ( 5 6 Transition, Workflow, WorkflowVersions, WorkflowInfo, WorkflowState, … … 7 8 from hurry.workflow.interfaces import ( 8 9 IWorkflow, IWorkflowState, IWorkflowInfo, IWorkflowVersions, 9 InvalidTransitionError )10 InvalidTransitionError, IWorkflowTransitionEvent) 10 11 from waeup.sirp.applicants.interfaces import IApplicantBaseData 11 12 … … 153 154 grok.context(IApplicantBaseData) 154 155 grok.provides(IWorkflowInfo) 156 157 158 @grok.subscribe(IApplicantBaseData, IWorkflowTransitionEvent) 159 def handle_applicant_transition_event(obj, event): 160 """Append message to applicant when transition happened. 161 """ 162 timestamp = datetime.now().strftime("%d/%m/%Y %H:%M:%S") 163 comment = event.comment or '(no comment)' 164 # XXX: `messages` is meta data which shouldn't really be part of 165 # the Applicant class. Furthermore we should not store HTML 166 # code but simple messages. This has to be cleaned up 167 # further. For now we replace the redundant code in browser 168 # mod. As we're here: one could use permissions and similar 169 # to finetune transitions instead of doing that manually in 170 # UI stuff. 171 msg = '%s - %s to %s: %s: %s' % ( 172 timestamp, event.source, event.destination, event.transition.title, 173 comment) 174 msgs = getattr(obj, 'messages', None) 175 if msgs != '': 176 msgs += '<br />' 177 obj.messages += msg 178 return
Note: See TracChangeset for help on using the changeset viewer.