本文整理汇总了Python中MoinMoin.PageEditor.PageEditor.getSubscribers方法的典型用法代码示例。如果您正苦于以下问题:Python PageEditor.getSubscribers方法的具体用法?Python PageEditor.getSubscribers怎么用?Python PageEditor.getSubscribers使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MoinMoin.PageEditor.PageEditor
的用法示例。
在下文中一共展示了PageEditor.getSubscribers方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: commentNotify
# 需要导入模块: from MoinMoin.PageEditor import PageEditor [as 别名]
# 或者: from MoinMoin.PageEditor.PageEditor import getSubscribers [as 别名]
def commentNotify(comment, trivial, comtext=''):
request = Globs.macro.request
if hasattr(request.cfg, 'mail_enabled'):
mail_enabled = request.cfg.mail_enabled
elif hasattr(request.cfg, 'mail_smarthost'):
mail_enabled = request.cfg.mail_smarthost
else:
mail_enabled = ''
if not mail_enabled:
return ''
_ = request.getText
pg = PageEditor( request, Globs.curpagename )
subscribers = pg.getSubscribers(request, return_users=1, trivial=trivial)
if subscribers:
# get a list of old revisions, and append a diff
# send email to all subscribers
results = [_('Status of sending notification mails:')]
for lang in subscribers.keys():
emails = map(lambda u: u.email, subscribers[lang])
names = map(lambda u: u.name, subscribers[lang])
mailok, status = sendNotification(pg, comtext, comment, emails, lang, trivial)
recipients = ", ".join(names)
results.append(_('[%(lang)s] %(recipients)s: %(status)s') % {
'lang': lang, 'recipients': recipients, 'status': status})
# Return mail sent results. Ignore trivial - we don't have
# to lie. If mail was sent, just tell about it.
return '<p>\n%s\n</p> ' % '<br>'.join(results)
# No mail sent, no message.
return ''