comparison rhodecode/model/notification.py @ 1800:6c86c987cf93 beta

pep8ify
author Marcin Kuzminski <marcin@python-works.com>
date Wed, 21 Dec 2011 02:56:39 +0200
parents 2aee0dc1784e
children cf51bbfb120e
comparison
equal deleted inserted replaced
1798:2ee93fba129e 1800:6c86c987cf93
2 """ 2 """
3 rhodecode.model.notification 3 rhodecode.model.notification
4 ~~~~~~~~~~~~~~ 4 ~~~~~~~~~~~~~~
5 5
6 Model for notifications 6 Model for notifications
7 7
8 8
9 :created_on: Nov 20, 2011 9 :created_on: Nov 20, 2011
10 :author: marcink 10 :author: marcink
11 :copyright: (C) 2009-2011 Marcin Kuzminski <marcin@python-works.com> 11 :copyright: (C) 2009-2011 Marcin Kuzminski <marcin@python-works.com>
12 :license: GPLv3, see COPYING for more details. 12 :license: GPLv3, see COPYING for more details.
13 """ 13 """
59 59
60 def create(self, created_by, subject, body, recipients=None, 60 def create(self, created_by, subject, body, recipients=None,
61 type_=Notification.TYPE_MESSAGE, with_email=True, 61 type_=Notification.TYPE_MESSAGE, with_email=True,
62 email_kwargs={}): 62 email_kwargs={}):
63 """ 63 """
64 64
65 Creates notification of given type 65 Creates notification of given type
66 66
67 :param created_by: int, str or User instance. User who created this 67 :param created_by: int, str or User instance. User who created this
68 notification 68 notification
69 :param subject: 69 :param subject:
70 :param body: 70 :param body:
71 :param recipients: list of int, str or User objects, when None 71 :param recipients: list of int, str or User objects, when None
102 # send email with notification 102 # send email with notification
103 for rec in recipients_objs: 103 for rec in recipients_objs:
104 email_subject = NotificationModel().make_description(notif, False) 104 email_subject = NotificationModel().make_description(notif, False)
105 type_ = type_ 105 type_ = type_
106 email_body = body 106 email_body = body
107 kwargs = {'subject':subject, 'body':h.rst_w_mentions(body)} 107 kwargs = {'subject': subject, 'body': h.rst_w_mentions(body)}
108 kwargs.update(email_kwargs) 108 kwargs.update(email_kwargs)
109 email_body_html = EmailNotificationModel()\ 109 email_body_html = EmailNotificationModel()\
110 .get_email_tmpl(type_, **kwargs) 110 .get_email_tmpl(type_, **kwargs)
111 run_task(tasks.send_email, rec.email, email_subject, email_body, 111 run_task(tasks.send_email, rec.email, email_subject, email_body,
112 email_body_html) 112 email_body_html)