comparison rhodecode/model/notification.py @ 2447:4753a3445ff7 codereview

merge with beta
author Marcin Kuzminski <marcin@python-works.com>
date Mon, 11 Jun 2012 23:28:22 +0200
parents fd0a822481ec 9b623dcddb02
children d04243e932cc
comparison
equal deleted inserted replaced
2444:b45e9fd75ac0 2447:4753a3445ff7
30 import datetime 30 import datetime
31 31
32 from pylons.i18n.translation import _ 32 from pylons.i18n.translation import _
33 33
34 import rhodecode 34 import rhodecode
35 from rhodecode.config.conf import DATETIME_FORMAT
36 from rhodecode.lib import helpers as h 35 from rhodecode.lib import helpers as h
37 from rhodecode.model import BaseModel 36 from rhodecode.model import BaseModel
38 from rhodecode.model.db import Notification, User, UserNotification 37 from rhodecode.model.db import Notification, User, UserNotification
39 from sqlalchemy.orm import joinedload 38 from sqlalchemy.orm import joinedload
40 39
207 _n.TYPE_REGISTRATION: _('registered in RhodeCode'), 206 _n.TYPE_REGISTRATION: _('registered in RhodeCode'),
208 _n.TYPE_PULL_REQUEST: _('opened new pull request'), 207 _n.TYPE_PULL_REQUEST: _('opened new pull request'),
209 _n.TYPE_PULL_REQUEST_COMMENT: _('commented on pull request') 208 _n.TYPE_PULL_REQUEST_COMMENT: _('commented on pull request')
210 } 209 }
211 210
212 tmpl = "%(user)s %(action)s %(when)s" 211 # action == _map string
212 tmpl = "%(user)s %(action)s at %(when)s"
213 if show_age: 213 if show_age:
214 when = h.age(notification.created_on) 214 when = h.age(notification.created_on)
215 else: 215 else:
216 DTF = lambda d: datetime.datetime.strftime(d, DATETIME_FORMAT) 216 when = h.fmt_date(notification.created_on)
217 when = DTF(notification.created_on)
218 217
219 data = dict( 218 data = dict(
220 user=notification.created_by_user.username, 219 user=notification.created_by_user.username,
221 action=_map[notification.type_], when=when, 220 action=_map[notification.type_], when=when,
222 ) 221 )