aboutsummaryrefslogtreecommitdiff
path: root/rhodecode
diff options
context:
space:
mode:
authorMarcin Kuzminski <marcin@python-works.com>2012-03-01 02:52:46 +0200
committerMarcin Kuzminski <marcin@python-works.com>2012-03-01 02:52:46 +0200
commit8a4a8af7e79c7fe8c747906610cd27272d23f479 (patch)
treec46796e89786a671f293f42b9c970b75b96db6f0 /rhodecode
parent476698af24885a47f7a2cf41132492734b451002 (diff)
code garden
--HG-- branch : beta
Diffstat (limited to 'rhodecode')
-rw-r--r--rhodecode/model/comment.py6
-rw-r--r--rhodecode/model/notification.py27
2 files changed, 18 insertions, 15 deletions
diff --git a/rhodecode/model/comment.py b/rhodecode/model/comment.py
index 8e23ee58..3753198c 100644
--- a/rhodecode/model/comment.py
+++ b/rhodecode/model/comment.py
@@ -67,7 +67,7 @@ class ChangesetCommentsModel(BaseModel):
repo = Repository.get(repo_id)
cs = repo.scm_instance.get_changeset(revision)
desc = cs.message
- author = cs.author_email
+ author_email = cs.author_email
comment = ChangesetComment()
comment.repo = repo
comment.user_id = user_id
@@ -96,8 +96,8 @@ class ChangesetCommentsModel(BaseModel):
# get the current participants of this changeset
recipients = ChangesetComment.get_users(revision=revision)
- # add changeset author
- recipients += [User.get_by_email(author)]
+ # add changeset author if it's in rhodecode system
+ recipients += [User.get_by_email(author_email)]
NotificationModel().create(
created_by=user_id, subject=subj, body=body,
diff --git a/rhodecode/model/notification.py b/rhodecode/model/notification.py
index 38487051..c8ef0f80 100644
--- a/rhodecode/model/notification.py
+++ b/rhodecode/model/notification.py
@@ -169,10 +169,12 @@ class NotificationModel(BaseModel):
of notification object
"""
- _map = {notification.TYPE_CHANGESET_COMMENT:_('commented on commit'),
- notification.TYPE_MESSAGE:_('sent message'),
- notification.TYPE_MENTION:_('mentioned you'),
- notification.TYPE_REGISTRATION:_('registered in RhodeCode')}
+ _map = {
+ notification.TYPE_CHANGESET_COMMENT: _('commented on commit'),
+ notification.TYPE_MESSAGE: _('sent message'),
+ notification.TYPE_MENTION: _('mentioned you'),
+ notification.TYPE_REGISTRATION: _('registered in RhodeCode')
+ }
DATETIME_FORMAT = "%Y-%m-%d %H:%M:%S"
@@ -182,9 +184,10 @@ class NotificationModel(BaseModel):
else:
DTF = lambda d: datetime.datetime.strftime(d, DATETIME_FORMAT)
when = DTF(notification.created_on)
- data = dict(user=notification.created_by_user.username,
- action=_map[notification.type_],
- when=when)
+ data = dict(
+ user=notification.created_by_user.username,
+ action=_map[notification.type_], when=when,
+ )
return tmpl % data
@@ -200,10 +203,10 @@ class EmailNotificationModel(BaseModel):
self._tmpl_lookup = rhodecode.CONFIG['pylons.app_globals'].mako_lookup
self.email_types = {
- self.TYPE_CHANGESET_COMMENT:'email_templates/changeset_comment.html',
- self.TYPE_PASSWORD_RESET:'email_templates/password_reset.html',
- self.TYPE_REGISTRATION:'email_templates/registration.html',
- self.TYPE_DEFAULT:'email_templates/default.html'
+ self.TYPE_CHANGESET_COMMENT: 'email_templates/changeset_comment.html',
+ self.TYPE_PASSWORD_RESET: 'email_templates/password_reset.html',
+ self.TYPE_REGISTRATION: 'email_templates/registration.html',
+ self.TYPE_DEFAULT: 'email_templates/default.html'
}
def get_email_tmpl(self, type_, **kwargs):
@@ -216,7 +219,7 @@ class EmailNotificationModel(BaseModel):
base = self.email_types.get(type_, self.email_types[self.TYPE_DEFAULT])
email_template = self._tmpl_lookup.get_template(base)
# translator inject
- _kwargs = {'_':_}
+ _kwargs = {'_': _}
_kwargs.update(kwargs)
log.debug('rendering tmpl %s with kwargs %s' % (base, _kwargs))
return email_template.render(**_kwargs)