本文整理汇总了Python中trac.notification.NotifyEmail.notify方法的典型用法代码示例。如果您正苦于以下问题:Python NotifyEmail.notify方法的具体用法?Python NotifyEmail.notify怎么用?Python NotifyEmail.notify使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类trac.notification.NotifyEmail
的用法示例。
在下文中一共展示了NotifyEmail.notify方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: invite
# 需要导入模块: from trac.notification import NotifyEmail [as 别名]
# 或者: from trac.notification.NotifyEmail import notify [as 别名]
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)
示例2: notify_unreachable_milestone
# 需要导入模块: from trac.notification import NotifyEmail [as 别名]
# 或者: from trac.notification.NotifyEmail import notify [as 别名]
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)
示例3: notifyTaskEvent
# 需要导入模块: from trac.notification import NotifyEmail [as 别名]
# 或者: from trac.notification.NotifyEmail import notify [as 别名]
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")
示例4: notify
# 需要导入模块: from trac.notification import NotifyEmail [as 别名]
# 或者: from trac.notification.NotifyEmail import notify [as 别名]
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)
示例5: notify_opened_ticket
# 需要导入模块: from trac.notification import NotifyEmail [as 别名]
# 或者: from trac.notification.NotifyEmail import notify [as 别名]
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)
示例6: notify
# 需要导入模块: from trac.notification import NotifyEmail [as 别名]
# 或者: from trac.notification.NotifyEmail import notify [as 别名]
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)
示例7: notify
# 需要导入模块: from trac.notification import NotifyEmail [as 别名]
# 或者: from trac.notification.NotifyEmail import notify [as 别名]
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)
示例8: notify
# 需要导入模块: from trac.notification import NotifyEmail [as 别名]
# 或者: from trac.notification.NotifyEmail import notify [as 别名]
def notify(self, build_info):
self.build_info = build_info
self.data = self.build_info
subject = '[%s Build] %s [%s] %s' % (self.build_info.status,
self.env.project_name,
self.build_info.changeset,
self.build_info.config)
stream = self.template.generate(**self.data)
body = stream.render('text')
self.env.log.debug('notification: %s' % body )
NotifyEmail.notify(self, self.build_info.id, subject)
示例9: remind
# 需要导入模块: from trac.notification import NotifyEmail [as 别名]
# 或者: from trac.notification.NotifyEmail import notify [as 别名]
def remind(self, tiketsByReporter):
"""
Send a digest mail to the reporter to remind them
of those orphaned tickets
"""
for reporter in tiketsByReporter.keys():
# prepare the data for the email content generation
self.data.update({
"ticket_count": len(tiketsByReporter[owner]),
"delay": delay
})
NotifyEmail.notify(self, reporter, "orphaned ticket notification")
示例10: notify
# 需要导入模块: from trac.notification import NotifyEmail [as 别名]
# 或者: from trac.notification.NotifyEmail import notify [as 别名]
def notify(self, to, key):
addr = self.get_smtp_address(to)
if addr is None:
raise TracError('Invalid email address %s'%to)
self.hdf['to'] = addr
self.hdf['key'] = key
subject = 'TracBL API key for %s'%addr
NotifyEmail.notify(self, addr, subject)
示例11: notify
# 需要导入模块: from trac.notification import NotifyEmail [as 别名]
# 或者: from trac.notification.NotifyEmail import notify [as 别名]
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)
# DEVEL: Better use new 'finally' statement here, but
# still need to care for Python 2.4 (RHEL5.x) for now
except:
pass
self.config.set('notification', 'use_public_cc', old_public_cc)
示例12: notify_attachment
# 需要导入模块: from trac.notification import NotifyEmail [as 别名]
# 或者: from trac.notification.NotifyEmail import notify [as 别名]
def notify_attachment(self, ticket, author, filename, modtime, body):
"""Send ticket attachment notification (untranslated)"""
t = deactivate()
translated_fields = ticket.fields
try:
ticket.fields = TicketSystem(self.env).get_ticket_fields()
self.ticket = ticket
self.modtime = modtime
self.newticket = False
self.reporter = ''
self.owner = ''
link = self.env.abs_href.ticket(ticket.id)
summary = self.ticket['summary']
ticket_values = ticket.values.copy()
ticket_values['id'] = ticket.id
wrap_kargs = {
'initial_indent': ' ',
'subsequent_indent': ' ',
'linesep': CRLF
}
if 'ambiwidth' in getargspec(wrap)[0]:
wrap_kargs['ambiwidth'] = self.ambiwidth
ticket_values['description'] = wrap(
ticket_values.get('description', ''),
self.COLS,
**wrap_kargs
)
ticket_values['new'] = self.newticket
ticket_values['link'] = link
subject = 'Re: ' + self.format_subj(summary)
author = obfuscate_email_address(author)
change = { 'author': author }
self.data.update({
'ticket_props': self.format_props(),
'ticket_body_hdr': self.format_hdr(),
'subject': subject,
'ticket': ticket_values,
'change': change,
'changes_body': body,
})
NotifyEmail.notify(self, ticket.id, subject)
finally:
ticket.fields = translated_fields
reactivate(t)
示例13: notify
# 需要导入模块: from trac.notification import NotifyEmail [as 别名]
# 或者: from trac.notification.NotifyEmail import notify [as 别名]
def notify(self, comment):
self.comment_author = self._get_author_name(comment)
self.data.update({
"comment": comment,
"comment_url": self.env.abs_href() + comment.href(),
"project_url": self.env.project_url or self.env.abs_href(),
})
projname = self.config.get("project", "name")
subject = "Re: [%s] %s" % (projname, comment.link_text())
try:
NotifyEmail.notify(self, comment, subject)
except Exception, e:
self.env.log.error("Failure sending notification on creation of "
"comment #%d: %s", comment.id, e)
示例14: notify
# 需要导入模块: from trac.notification import NotifyEmail [as 别名]
# 或者: from trac.notification.NotifyEmail import notify [as 别名]
def notify(self, username, action):
self.data.update({
'account': {
'username': username,
'action': action
},
'login': {
'link': self.env.abs_href.login(),
}
})
projname = self.config.get('project', 'name')
subject = '[%s] %s: %s' % (projname, action, username)
try:
NotifyEmail.notify(self, username, subject)
except Exception, e:
# Enable dedicated, graceful handling of notification issues.
raise NotificationError(e)
示例15: _notify
# 需要导入模块: from trac.notification import NotifyEmail [as 别名]
# 或者: from trac.notification.NotifyEmail import notify [as 别名]
def _notify(self, tickets, new_values, comment, action, author):
self.tickets = tickets
changes_body = ''
self.reporter = ''
self.owner = ''
changes_descr = '\n'.join(['%s to %s' % (prop, val)
for (prop, val) in new_values.iteritems()])
tickets_descr = ', '.join(['#%s' % t for t in tickets])
subject = self.format_subj(tickets_descr)
link = self.env.abs_href.query(id=','.join([str(t) for t in tickets]))
self.data.update({
'tickets_descr': tickets_descr,
'changes_descr': changes_descr,
'comment': comment,
'action': action,
'author': author,
'subject': subject,
'ticket_query_link': link,
})
NotifyEmail.notify(self, tickets, subject, author)