Changeset 11070 for main


Ignore:
Timestamp:
11 Feb 2014, 08:52:38 (11 years ago)
Author:
Henrik Bettermann
Message:

Merge with previous revision in trunk.

Location:
main/waeup.kofa/branches/uli-diazo-themed/src/waeup/kofa
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • main/waeup.kofa/branches/uli-diazo-themed/src/waeup/kofa

  • main/waeup.kofa/branches/uli-diazo-themed/src/waeup/kofa/objecthistory.py

    r9126 r11070  
    5353        return self._getMessages()
    5454
    55     def addMessage(self, msg):
     55    def addMessage(self, msg, user=None):
    5656        """Add the message (history entry) in msg.
    5757
    5858        Any message will be stored with a timestamp and the current
    59         user (principal).
     59        user (principal) if user parameter is None.
    6060        """
    6161        msgs = self._getMessages()
    6262        tz = getUtility(IKofaUtils).tzinfo
    6363        timestamp = now(tz).strftime("%Y-%m-%d %H:%M:%S %Z")
    64         user = get_current_principal()
    65         if user is None:
    66             usertitle = 'system'
    67         elif user.id == 'zope.anybody':
    68             usertitle = 'Anonymous'
     64        portal_language = getUtility(IKofaUtils).PORTAL_LANGUAGE
     65        msg = translate(msg,'waeup.kofa',target_language=portal_language)
     66        by = translate(_('by'),'waeup.kofa',target_language=portal_language)
     67        if user == None:
     68            user = get_current_principal()
     69            if user is None:
     70                usertitle = 'system'
     71            elif user.id == 'zope.anybody':
     72                usertitle = 'Anonymous'
     73            else:
     74                usertitle = getattr(user, 'public_name', None)
     75                if not usertitle:
     76                    usertitle = user.title
     77            msg = u'%s - %s %s %s' % (timestamp, msg, by, usertitle)
     78        elif user == 'undisclosed':
     79            msg = u'%s - %s' % (timestamp, msg)
    6980        else:
    70             usertitle = getattr(user, 'public_name', None)
    71             if not usertitle:
    72                 usertitle = user.title
    73         portal_language = getUtility(IKofaUtils).PORTAL_LANGUAGE
    74         by = translate(_('by'),'waeup.kofa',target_language=portal_language)
    75         msg = translate(msg,'waeup.kofa',target_language=portal_language)
    76         msg = u'%s - %s %s %s' % (timestamp, msg, by, usertitle)
     81            msg = u'%s - %s %s %s' % (timestamp, msg, by, user)
    7782        msgs.append(msg)
    7883        self._annotations[self.history_key] = msgs
Note: See TracChangeset for help on using the changeset viewer.