Ignore:
Timestamp:
23 Jun 2011, 15:29:31 (14 years ago)
Author:
Henrik Bettermann
Message:

Produce more user friendly and shorter object history messages.

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  
    139139            if 'disable' in form:
    140140                try:
    141                     comment = u"Disabled by %s" % self.request.principal.id
     141                    comment = u"AC disabled"
    142142                    self.context.disable(entry, comment)
    143143                    self.flash('%s disabled.' % entry)
     
    146146            elif 'enable' in form:
    147147                try:
    148                     comment = u"Re-enabled by %s" % self.request.principal.id
     148                    comment = u"AC re-enabled"
    149149                    self.context.enable(entry, comment)
    150150                    self.flash('%s (re-)enabled.' % entry)
  • main/waeup.sirp/trunk/src/waeup/sirp/accesscodes/tests/test_accesscodes.py

    r6470 r6471  
    192192        history = IObjectHistory(self.ac1)
    193193        msgs = history.messages
    194         assert msgs[-1].endswith('Used by system')
     194        assert msgs[-1].endswith('AC used by system')
    195195
    196196class AccessCodeTests(FunctionalTestCase):
     
    236236        # Access codes have a history.
    237237        match = re.match(
    238             '^../../.... ..:..:.. - Initialized by system',
     238            '^....-..-.. ..:..:.. - AC initialized by system',
    239239            self.ac1.history)
    240240        assert match is not None
  • main/waeup.sirp/trunk/src/waeup/sirp/accesscodes/workflow.py

    r6459 r6471  
    120120def handle_accesscode_transition_event(obj, event):
    121121    # append message to history
    122     timestamp = datetime.now().strftime("%d/%m/%Y %H:%M:%S")
    123     msg = '%s -' % timestamp
    124122    if event.comment is not None:
    125         msg = '%s %s' % (msg, event.comment)
     123        msg = '%s' % event.comment
    126124    else:
    127         msg = '%s %s by system' % (msg,event.destination.title())
     125        msg = 'AC %s' % event.destination
    128126
    129127    history = IObjectHistory(obj)
  • main/waeup.sirp/trunk/src/waeup/sirp/applicants/browser.py

    r6470 r6471  
    429429            pass
    430430        else:
    431             comment = u"Invalidated by applicant"
     431            comment = u"AC invalidated"
    432432            # Here we know that the ac is in state initialized so we do not
    433433            # expect an exception
    434             invalidate_accesscode(pin, comment)
     434            invalidate_accesscode(pin,comment)
    435435
    436436        if not pin in self.context.keys():
  • main/waeup.sirp/trunk/src/waeup/sirp/applicants/workflow.py

    r6355 r6471  
    2222        source = None,
    2323        condition = NullCondition,
    24         msg = 'application process initialized',
     24        msg = 'Application initialized',
    2525        destination = INITIALIZED),
    2626
     
    2828        transition_id = 'start',
    2929        title = 'Start application',
    30         msg = 'application process started',
     30        msg = 'Application started',
    3131        source = INITIALIZED,
    3232        destination = STARTED),
     
    3535        transition_id = 'submit',
    3636        title = 'Submit application',
    37         msg = 'application record submitted',
     37        msg = 'Application submitted',
    3838        source = STARTED,
    3939        destination = SUBMITTED),
     
    4242        transition_id = 'admit',
    4343        title = 'Admit applicant',
    44         msg = 'applicant admitted',
     44        msg = 'Applicant admitted',
    4545        source = SUBMITTED,
    4646        destination = ADMITTED),
     
    4949        transition_id = 'refuse1',
    5050        title = 'Refuse application',
    51         msg = 'application refused',
     51        msg = 'Application refused',
    5252        source = SUBMITTED,
    5353        destination = NOT_ADMITTED),
     
    5656        transition_id = 'refuse2',
    5757        title = 'Refuse application',
    58         msg = 'application refused',
     58        msg = 'Application refused',
    5959        source = ADMITTED,
    6060        destination = NOT_ADMITTED),
     
    6363        transition_id = 'create',
    6464        title = 'Create student record',
    65         msg = 'student record created',
     65        msg = 'Student record created',
    6666        source = ADMITTED,
    6767        destination = CREATED),
     
    7070        transition_id = 'reset1',
    7171        title = 'Reset application',
    72         msg = 'application record reset',
     72        msg = 'Application reset',
    7373        source = SUBMITTED,
    7474        destination = STARTED),
     
    7777        transition_id = 'reset2',
    7878        title = 'Reset application',
    79         msg = 'application record reset',
     79        msg = 'Application reset',
    8080        source = ADMITTED,
    8181        destination = STARTED),
     
    8484        transition_id = 'reset3',
    8585        title = 'Reset application',
    86         msg = 'application record reset',
     86        msg = 'Application reset',
    8787        source = NOT_ADMITTED,
    8888        destination = STARTED),
     
    9191        transition_id = 'reset4',
    9292        title = 'Reset application',
    93         msg = 'application record reset',
     93        msg = 'Application reset',
    9494        source = CREATED,
    9595        destination = STARTED),
     
    119119@grok.subscribe(IApplicantBaseData, IWorkflowTransitionEvent)
    120120def handle_applicant_transition_event(obj, event):
    121     """Append message to applicant when transition happened.
     121    """Append message to applicant history when transition happened.
    122122    """
    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']
    126124    history = IObjectHistory(obj)
    127125    history.addMessage(msg)
  • main/waeup.sirp/trunk/src/waeup/sirp/objecthistory.py

    r6468 r6471  
    6464        if user is None:
    6565            user = 'system'
     66        elif user.title == 'Applicant':
     67            user = 'applicant'
    6668        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)
    6971        msgs.append(msg)
    7072        self._annotations[self.history_key] = msgs
  • main/waeup.sirp/trunk/src/waeup/sirp/tests/test_objecthistory.py

    r6467 r6471  
    6363        hist.addMessage('blah')
    6464        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)
    6666
    6767    def test_add_messages_existing_principal(self):
     
    7272        hist.addMessage('blah')
    7373        result = ''.join(hist.messages)
    74         self.assertMatches('<YYYY-MM-DD hh:mm:ss> - bob (Bob) - blah', result)
     74        self.assertMatches('<YYYY-MM-DD hh:mm:ss> - blah by bob', result)
    7575
    7676    def test_messages(self):
Note: See TracChangeset for help on using the changeset viewer.