##// END OF EJS Templates
Format datetime in notifications according to unified function
marcink -
r2445:9b623dcd beta
parent child Browse files
Show More
@@ -44,6 +44,7 b' from rhodecode.lib.utils2 import str2boo'
44 44 from rhodecode.lib.markup_renderer import MarkupRenderer
45 45 from rhodecode.lib.vcs.exceptions import ChangesetDoesNotExistError
46 46 from rhodecode.lib.vcs.backends.base import BaseChangeset
47 from rhodecode.config.conf import DATE_FORMAT, DATETIME_FORMAT
47 48 from rhodecode.model.db import URL_SEP
48 49
49 50 log = logging.getLogger(__name__)
@@ -350,8 +351,8 b" hide_credentials = lambda x: ''.join(cre"
350 351
351 352 def fmt_date(date):
352 353 if date:
353 return (date.strftime(_(u"%a, %d %b %Y %H:%M:%S").encode('utf8'))
354 .decode('utf8'))
354 _fmt = _(u"%a, %d %b %Y %H:%M:%S").encode('utf8')
355 return date.strftime(_fmt).decode('utf8')
355 356
356 357 return ""
357 358
@@ -32,7 +32,6 b' import datetime'
32 32 from pylons.i18n.translation import _
33 33
34 34 import rhodecode
35 from rhodecode.config.conf import DATETIME_FORMAT
36 35 from rhodecode.lib import helpers as h
37 36 from rhodecode.model import BaseModel
38 37 from rhodecode.model.db import Notification, User, UserNotification
@@ -181,12 +180,12 b' class NotificationModel(BaseModel):'
181 180 notification.TYPE_REGISTRATION: _('registered in RhodeCode')
182 181 }
183 182
184 tmpl = "%(user)s %(action)s %(when)s"
183 # action == _map string
184 tmpl = "%(user)s %(action)s at %(when)s"
185 185 if show_age:
186 186 when = h.age(notification.created_on)
187 187 else:
188 DTF = lambda d: datetime.datetime.strftime(d, DATETIME_FORMAT)
189 when = DTF(notification.created_on)
188 when = h.fmt_date(notification.created_on)
190 189
191 190 data = dict(
192 191 user=notification.created_by_user.username,
General Comments 0
You need to be logged in to leave comments. Login now