Changeset 6471 for main/waeup.sirp/trunk/src
- Timestamp:
- 23 Jun 2011, 15:29:31 (13 years ago)
- Location:
- main/waeup.sirp/trunk/src/waeup/sirp
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.sirp/trunk/src/waeup/sirp/accesscodes/browser.py
r6459 r6471 139 139 if 'disable' in form: 140 140 try: 141 comment = u" Disabled by %s" % self.request.principal.id141 comment = u"AC disabled" 142 142 self.context.disable(entry, comment) 143 143 self.flash('%s disabled.' % entry) … … 146 146 elif 'enable' in form: 147 147 try: 148 comment = u" Re-enabled by %s" % self.request.principal.id148 comment = u"AC re-enabled" 149 149 self.context.enable(entry, comment) 150 150 self.flash('%s (re-)enabled.' % entry) -
main/waeup.sirp/trunk/src/waeup/sirp/accesscodes/tests/test_accesscodes.py
r6470 r6471 192 192 history = IObjectHistory(self.ac1) 193 193 msgs = history.messages 194 assert msgs[-1].endswith(' Used by system')194 assert msgs[-1].endswith('AC used by system') 195 195 196 196 class AccessCodeTests(FunctionalTestCase): … … 236 236 # Access codes have a history. 237 237 match = re.match( 238 '^.. /../.... ..:..:.. - Initialized by system',238 '^....-..-.. ..:..:.. - AC initialized by system', 239 239 self.ac1.history) 240 240 assert match is not None -
main/waeup.sirp/trunk/src/waeup/sirp/accesscodes/workflow.py
r6459 r6471 120 120 def handle_accesscode_transition_event(obj, event): 121 121 # append message to history 122 timestamp = datetime.now().strftime("%d/%m/%Y %H:%M:%S")123 msg = '%s -' % timestamp124 122 if event.comment is not None: 125 msg = '%s %s' % (msg, event.comment)123 msg = '%s' % event.comment 126 124 else: 127 msg = ' %s %s by system' % (msg,event.destination.title())125 msg = 'AC %s' % event.destination 128 126 129 127 history = IObjectHistory(obj) -
main/waeup.sirp/trunk/src/waeup/sirp/applicants/browser.py
r6470 r6471 429 429 pass 430 430 else: 431 comment = u" Invalidated by applicant"431 comment = u"AC invalidated" 432 432 # Here we know that the ac is in state initialized so we do not 433 433 # expect an exception 434 invalidate_accesscode(pin, 434 invalidate_accesscode(pin,comment) 435 435 436 436 if not pin in self.context.keys(): -
main/waeup.sirp/trunk/src/waeup/sirp/applicants/workflow.py
r6355 r6471 22 22 source = None, 23 23 condition = NullCondition, 24 msg = ' application processinitialized',24 msg = 'Application initialized', 25 25 destination = INITIALIZED), 26 26 … … 28 28 transition_id = 'start', 29 29 title = 'Start application', 30 msg = ' application processstarted',30 msg = 'Application started', 31 31 source = INITIALIZED, 32 32 destination = STARTED), … … 35 35 transition_id = 'submit', 36 36 title = 'Submit application', 37 msg = ' application recordsubmitted',37 msg = 'Application submitted', 38 38 source = STARTED, 39 39 destination = SUBMITTED), … … 42 42 transition_id = 'admit', 43 43 title = 'Admit applicant', 44 msg = ' applicant admitted',44 msg = 'Applicant admitted', 45 45 source = SUBMITTED, 46 46 destination = ADMITTED), … … 49 49 transition_id = 'refuse1', 50 50 title = 'Refuse application', 51 msg = ' application refused',51 msg = 'Application refused', 52 52 source = SUBMITTED, 53 53 destination = NOT_ADMITTED), … … 56 56 transition_id = 'refuse2', 57 57 title = 'Refuse application', 58 msg = ' application refused',58 msg = 'Application refused', 59 59 source = ADMITTED, 60 60 destination = NOT_ADMITTED), … … 63 63 transition_id = 'create', 64 64 title = 'Create student record', 65 msg = ' student record created',65 msg = 'Student record created', 66 66 source = ADMITTED, 67 67 destination = CREATED), … … 70 70 transition_id = 'reset1', 71 71 title = 'Reset application', 72 msg = ' application recordreset',72 msg = 'Application reset', 73 73 source = SUBMITTED, 74 74 destination = STARTED), … … 77 77 transition_id = 'reset2', 78 78 title = 'Reset application', 79 msg = ' application recordreset',79 msg = 'Application reset', 80 80 source = ADMITTED, 81 81 destination = STARTED), … … 84 84 transition_id = 'reset3', 85 85 title = 'Reset application', 86 msg = ' application recordreset',86 msg = 'Application reset', 87 87 source = NOT_ADMITTED, 88 88 destination = STARTED), … … 91 91 transition_id = 'reset4', 92 92 title = 'Reset application', 93 msg = ' application recordreset',93 msg = 'Application reset', 94 94 source = CREATED, 95 95 destination = STARTED), … … 119 119 @grok.subscribe(IApplicantBaseData, IWorkflowTransitionEvent) 120 120 def handle_applicant_transition_event(obj, event): 121 """Append message to applicant when transition happened.121 """Append message to applicant history when transition happened. 122 122 """ 123 timestamp = datetime.now().strftime("%d/%m/%Y %H:%M:%S") 124 msg = '%s - %s (new state: %s)' % ( 125 timestamp, event.transition.user_data['msg'], event.destination) 123 msg = '%s' % event.transition.user_data['msg'] 126 124 history = IObjectHistory(obj) 127 125 history.addMessage(msg) -
main/waeup.sirp/trunk/src/waeup/sirp/objecthistory.py
r6468 r6471 64 64 if user is None: 65 65 user = 'system' 66 elif user.title == 'Applicant': 67 user = 'applicant' 66 68 else: 67 user = '%s (%s)' % (user.id, user.title)68 msg = '%s - %s - %s' % (timestamp, user, msg)69 user = user.id 70 msg = '%s - %s by %s' % (timestamp, msg, user) 69 71 msgs.append(msg) 70 72 self._annotations[self.history_key] = msgs -
main/waeup.sirp/trunk/src/waeup/sirp/tests/test_objecthistory.py
r6467 r6471 63 63 hist.addMessage('blah') 64 64 result = ''.join(hist.messages) 65 self.assertMatches('<YYYY-MM-DD hh:mm:ss> - system - blah', result)65 self.assertMatches('<YYYY-MM-DD hh:mm:ss> - blah by system', result) 66 66 67 67 def test_add_messages_existing_principal(self): … … 72 72 hist.addMessage('blah') 73 73 result = ''.join(hist.messages) 74 self.assertMatches('<YYYY-MM-DD hh:mm:ss> - b ob (Bob) - blah', result)74 self.assertMatches('<YYYY-MM-DD hh:mm:ss> - blah by bob', result) 75 75 76 76 def test_messages(self):
Note: See TracChangeset for help on using the changeset viewer.