本文整理汇总了Python中trac.notification.NotifyEmail类的典型用法代码示例。如果您正苦于以下问题:Python NotifyEmail类的具体用法?Python NotifyEmail怎么用?Python NotifyEmail使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了NotifyEmail类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: notifyTaskEvent
def notifyTaskEvent(self, task_event_list):
"""
Send task event by mail if recipients is defined in trac.ini
"""
self.env.log.debug("notifying task event...")
if self.cronconf.get_email_notifier_task_recipient() :
# prepare the data for the email content generation
mess = ""
start = True
for event in task_event_list:
if start:
mess = mess + "task[%s]" % (event.task.getId(),)
mess = mess + "\nstarted at %d h %d" % (event.time.tm_hour, event.time.tm_min)
mess = mess + "\n"
else:
mess = mess + "ended at %d h %d" % (event.time.tm_hour, event.time.tm_min)
if (event.success):
mess = mess + "\nsuccess"
else:
mess = mess + "\nFAILURE"
mess = mess + "\n\n"
start = not start
self.data.update({
"notify_body": mess,
})
NotifyEmail.notify(self, None, "task event notification")
else:
self.env.log.debug("no recipient for task event, aborting")
示例2: __init__
def __init__(self, env):
NotifyEmail.__init__(self, env)
self.prev_cc = []
self.ambiguous_char_width = env.config.get('notification',
'ambiguous_char_width',
'single')
self.text_widths = {}
示例3: notify_unreachable_milestone
def notify_unreachable_milestone(self, tickets):
"""
Send a digest mail listing all tickets still opened in the milestone
"""
self.populate_unreachable_tickets_data(tickets)
NotifyEmail.notify(self, self.milestone, "Milestone %s still has opened ticket" % self.milestone)
示例4: __init__
def __init__(self, env):
NotifyEmail.__init__(self, env)
self.prev_cc = []
ambiguous_char_width = env.config.get('notification',
'ambiguous_char_width',
'single')
self.ambiwidth = 2 if ambiguous_char_width == 'double' else 1
示例5: invite
def invite(self, context, forum = None, topic = None, recipients = []):
# Store link to currently notifying forum.
self.forum = forum
self.topic = topic
# Initialize template data.
data = {}
data['forum'] = self.forum
data['topic'] = self.topic
data['prefix'] = self.config.get('notification', 'smtp_subject_prefix')
if data['prefix'] == '__default__':
data['prefix'] = self.env.project_name
self.data.update({'discussion' : data})
# Which item notify about?
if self.topic:
self.topic['link'] = self.env.abs_href.discussion('topic',
self.topic['id'])
self.template_name = 'topic-invite-body.txt'
elif self.forum:
self.forum['link'] = self.env.abs_href.discussion('forum',
self.forum['id'])
self.template_name = 'forum-invite-body.txt'
# Send e-mail to all subscribers.
self.cc_recipients = recipients
# Render subject template and send notification.
subject = (to_unicode(Chrome(self.env).render_template(context.req,
self.topic and 'topic-invite-subject.txt' or
'forum-invite-subject.txt', self.data, 'text/plain'))).strip()
NotifyEmail.notify(self, id, subject)
示例6: send
def send(self, torcpts, ccrcpts):
header = {}
# Add item specific e-mail header fields.
if self.message:
# Get this messge ID.
header['Message-ID'] = self.get_message_id(self.forum['id'],
self.topic['id'], self.message['id'])
header['X-Trac-Message-ID'] = to_unicode(self.message['id'])
header['X-Trac-Discussion-URL'] = self.message['link']
# Get replied message ID.
reply_id = self.get_message_id(self.forum['id'], self.topic['id'],
self.message['replyto'])
header['In-Reply-To'] = reply_id
header['References'] = reply_id
else:
# Get this message ID.
header['Message-ID'] = self.get_message_id(self.forum['id'],
self.topic['id'], 0)
header['X-Trac-Topic-ID'] = to_unicode(self.topic['id'])
header['X-Trac-Discussion-URL'] = self.topic['link']
# Send e-mail.
NotifyEmail.send(self, torcpts, ccrcpts, header)
示例7: send
def send(self, to_recipients, cc_recipients):
header = {}
# Add item specific e-mail header fields.
if self.message:
# ID of the message.
header["Message-ID"] = self.get_message_email_id(self.message["id"])
header["X-Trac-Message-ID"] = to_unicode(self.message["id"])
header["X-Trac-Discussion-URL"] = self.message["link"]
# ID of replied message.
if self.message["replyto"] != -1:
reply_id = self.get_message_email_id(self.message["replyto"])
else:
reply_id = self.get_topic_email_id(self.message["topic"])
header["In-Reply-To"] = reply_id
header["References"] = reply_id
elif self.topic:
# ID of the message.
header["Message-ID"] = self.get_topic_email_id(self.topic["id"])
header["X-Trac-Topic-ID"] = to_unicode(self.topic["id"])
header["X-Trac-Discussion-URL"] = self.topic["link"]
elif self.forum:
# ID of the message.
header["Message-ID"] = self.get_forum_email_id(self.forum["id"])
header["X-Trac-Forum-ID"] = to_unicode(self.forum["id"])
header["X-Trac-Discussion-URL"] = self.forum["link"]
else:
# Should not happen.
raise TracError("DiscussionPlugin internal error.")
# Send e-mail.
self.template = Chrome(self.env).load_template(self.template_name, method="text")
self.env.log.debug("to_recipients: %s cc_recipients: %s" % (to_recipients, cc_recipients))
NotifyEmail.send(self, to_recipients, cc_recipients, header)
示例8: notify
def notify(self, build):
self.build = build
self.data.update(self.template_data())
subject = '[%s Build] %s [%s] %s' % (self.readable_states[build.status],
self.env.project_name,
self.build.rev,
self.build.config)
NotifyEmail.notify(self, self.build.id, subject)
示例9: __init__
def __init__(self, env, subject=None, data=None):
NotifyEmail.__init__(self, env)
self.to = []
self.cc = []
self.from_email = env.config.get("notification", "smtp_from")
self.subject = subject or ""
# If string given, place it into body variable, otherwise use dict or empty dict
self.data = {"body": data} if isinstance(data, basestring) else data or {}
示例10: notify_opened_ticket
def notify_opened_ticket(self, owner, tickets):
"""
Send a digest mail to ticket owner
about ticket still opened
"""
self.populate_unreachable_tickets_data(tickets)
NotifyEmail.notify(self, owner, "Milestone %s still has opened ticket" % self.milestone)
示例11: __init__
def __init__(self, env):
NotifyEmail.__init__(self, env)
self.from_name = self.config.get('fullblog-notification', 'from_name')
self.from_email = self.config.get('fullblog-notification', 'from_email')
self.reply_to_email = self.config.get('fullblog-notification', 'reply_to_email') or self.from_email
self.notification_actions = self.config.getlist('fullblog-notification',
'notification_actions')
self.no_notification_categories = self.config.getlist('fullblog-notification',
'no_notification_categories')
示例12: __init__
def __init__(self, env, recipient, body, link):
NotifyEmail.__init__(self, env)
self.recipient = recipient
self.data = {
'body': body,
'link': link,
'project_name': env.project_name,
'project_url': env.project_url or self.env.abs_href(),
}
示例13: notify
def notify(self, username, subject):
# save the username for use in `get_smtp_address`
self._username = username
old_public_cc = self.config.getbool('notification', 'use_public_cc')
# override public cc option so that the user's email is included in the To: field
self.config.set('notification', 'use_public_cc', 'true')
try:
NotifyEmail.notify(self, username, subject)
finally:
self.config.set('notification', 'use_public_cc', old_public_cc)
示例14: notify
def notify(self, username, password):
# save the username for use in `get_smtp_address`
self._username = username
self.hdf['account.username'] = username
self.hdf['account.password'] = password
self.hdf['login.link'] = self.env.abs_href.login()
projname = self.config.get('project', 'name')
subject = '[%s] Trac password reset for user: %s' % (projname, username)
NotifyEmail.notify(self, username, subject)
示例15: __init__
def __init__(self, env, data, template_name=None):
NotifyEmail.__init__(self, env)
locale_dir = pkg_resources.resource_filename(__name__, 'locale')
add_domain(self.env.path, locale_dir)
if template_name:
self.template_name = template_name
self._data = data
if self._data and self._data['user_data']:
# self._locale_string = self._data['user_data']['language'] # not used at the moment
self._email_adr = self._data['user_data']['email']