- Timestamp:
- 21 Feb 2014, 11:07:54 (11 years ago)
- Location:
- main/waeup.kofa/branches/0.2
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.kofa/branches/0.2
- Property svn:mergeinfo changed
/main/waeup.kofa/trunk (added) merged: 10895,10900,10906,10908,10914,10933-10934,10944,11068,11090,11106,11142,11157-11158
- Property svn:mergeinfo changed
-
main/waeup.kofa/branches/0.2/src/waeup/kofa/objecthistory.py
r9126 r11161 53 53 return self._getMessages() 54 54 55 def addMessage(self, msg ):55 def addMessage(self, msg, user=None): 56 56 """Add the message (history entry) in msg. 57 57 58 58 Any message will be stored with a timestamp and the current 59 user (principal) .59 user (principal) if user parameter is None. 60 60 """ 61 61 msgs = self._getMessages() 62 62 tz = getUtility(IKofaUtils).tzinfo 63 63 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) 69 80 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) 77 82 msgs.append(msg) 78 83 self._annotations[self.history_key] = msgs
Note: See TracChangeset for help on using the changeset viewer.