当前位置: 首页>>代码示例>>Python>>正文


Python PageEditor.getSubscribers方法代码示例

本文整理汇总了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 ''
开发者ID:130s,项目名称:roswiki,代码行数:39,代码来源:PageComment2.py


注:本文中的MoinMoin.PageEditor.PageEditor.getSubscribers方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。