Changeset 8758 for main


Ignore:
Timestamp:
19 Jun 2012, 07:47:21 (13 years ago)
Author:
Henrik Bettermann
Message:

Use public_name in object histories and when approving payments.

Location:
main/waeup.kofa/trunk/src/waeup/kofa
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • main/waeup.kofa/trunk/src/waeup/kofa/objecthistory.py

    r8234 r8758  
    6464        user = get_current_principal()
    6565        if user is None:
    66             user = 'system'
     66            usertitle = 'system'
    6767        elif user.id == 'zope.anybody':
    68             user = 'Anonymous'
     68            usertitle = 'Anonymous'
    6969        else:
    70             user = user.title
     70            usertitle = getattr(user, 'public_name', None)
     71            if not usertitle:
     72                usertitle = user.title
    7173        portal_language = getUtility(IKofaUtils).PORTAL_LANGUAGE
    7274        by = translate(_('by'),'waeup.kofa',target_language=portal_language)
    7375        msg = translate(msg,'waeup.kofa',target_language=portal_language)
    74         msg = u'%s - %s %s %s' % (timestamp, msg, by, user)
     76        msg = u'%s - %s %s %s' % (timestamp, msg, by, usertitle)
    7577        msgs.append(msg)
    7678        self._annotations[self.history_key] = msgs
  • main/waeup.kofa/trunk/src/waeup/kofa/payments/payment.py

    r8703 r8758  
    8888            usertitle = 'system'
    8989        else:
    90             usertitle = user.title
     90            usertitle = getattr(user, 'public_name', None)
     91            if not usertitle:
     92                usertitle = user.title
    9193        r_desc = _('Payment approved by ${a}', mapping = {'a': usertitle})
    9294        portal_language = getUtility(IKofaUtils).PORTAL_LANGUAGE
  • main/waeup.kofa/trunk/src/waeup/kofa/students/tests/test_browser.py

    r8732 r8758  
    900900        self.assertTrue('Student has been cleared' in self.browser.contents)
    901901        self.assertTrue('cleared' in self.browser.contents)
     902        self.browser.open(self.history_path)
     903        self.assertTrue('Cleared by Carlo Pitter' in self.browser.contents)
     904        # Hide real name.
     905        self.app['users']['mrclear'].public_name = 'My Public Name'
     906        self.browser.open(self.clearance_path)
    902907        self.browser.getLink("Reject clearance").click()
    903908        self.assertTrue('Clearance has been annulled' in self.browser.contents)
     
    907912            '/contactstudent?subject=%s' % urlmessage)
    908913        self.assertTrue('clearance started' in self.browser.contents)
     914        self.browser.open(self.history_path)
     915        self.assertTrue("Reset to 'clearance' by My Public Name" in
     916            self.browser.contents)
    909917        IWorkflowInfo(self.student).fireTransition('request_clearance')
    910918        self.browser.open(self.clearance_path)
Note: See TracChangeset for help on using the changeset viewer.