Changeset 6459


Ignore:
Timestamp:
23 Jun 2011, 06:25:59 (14 years ago)
Author:
Henrik Bettermann
Message:

Change structure of history messages (not sure if unicode strings are appropriate here).

Location:
main/waeup.sirp/trunk/src/waeup/sirp
Files:
4 edited

Legend:

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

    r6455 r6459  
    139139            if 'disable' in form:
    140140                try:
    141                     self.context.disable(entry, self.request.principal.id)
     141                    comment = u"Disabled by %s" % self.request.principal.id
     142                    self.context.disable(entry, comment)
    142143                    self.flash('%s disabled.' % entry)
    143144                except InvalidTransitionError:
     
    145146            elif 'enable' in form:
    146147                try:
    147                     self.context.enable(entry, self.request.principal.id)
     148                    comment = u"Re-enabled by %s" % self.request.principal.id
     149                    self.context.enable(entry, comment)
    148150                    self.flash('%s (re-)enabled.' % entry)
    149151                except InvalidTransitionError:
  • main/waeup.sirp/trunk/src/waeup/sirp/accesscodes/tests/test_accesscodes.py

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

    r6425 r6459  
    121121    # append message to history
    122122    timestamp = datetime.now().strftime("%d/%m/%Y %H:%M:%S")
    123     msg = '%s - %s (new state: %s)' % (
    124         timestamp, event.destination.title(), event.destination)
     123    msg = '%s -' % timestamp
    125124    if event.comment is not None:
    126         msg = '%s, %s' % (msg, event.comment)
     125        msg = '%s %s' % (msg, event.comment)
     126    else:
     127        msg = '%s %s by system' % (msg,event.destination.title())
     128
    127129    history = IObjectHistory(obj)
    128130    history.addMessage(msg)
  • main/waeup.sirp/trunk/src/waeup/sirp/applicants/browser.py

    r6457 r6459  
    425425
    426426        # Mark pin as used (this also fires a pin related transition)
    427         invalidate_accesscode(pin)
     427        comment = u"Invalidated by applicant"
     428        invalidate_accesscode(pin, comment)
    428429
    429430        if not pin in self.context.keys():
     
    473474        ac_number = self.request.form.get('form.ac_number', None)
    474475        pin = '%s-%s-%s' % (self.ac_prefix,ac_series,ac_number)
    475         if not invalidate_accesscode(pin):
     476        if not invalidate_accesscode(pin, comment=u"Invalidated by system"):
    476477            self.flash('%s is not a valid access code.' % pin)
    477478            self.redirect(self.url(self.context, '@@manage')+'#tab-2')
     
    740741    grok.name('edit')
    741742    grok.require('waeup.handleApplication')
    742     form_fields = grok.AutoFields(IApplicantEdit).omit('locked')
     743    form_fields = grok.AutoFields(IApplicantEdit).omit(
     744        'locked', 'course_admitted', 'application_date', 'student_id',
     745        'screening_score',
     746        )
    743747    form_fields['passport'].custom_widget = EncodingImageFileWidget
    744748    form_fields['date_of_birth'].custom_widget = FriendlyDateWidget('le-year')
Note: See TracChangeset for help on using the changeset viewer.