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


Python Page.getSubscribers方法代码示例

本文整理汇总了Python中MoinMoin.Page.Page.getSubscribers方法的典型用法代码示例。如果您正苦于以下问题:Python Page.getSubscribers方法的具体用法?Python Page.getSubscribers怎么用?Python Page.getSubscribers使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在MoinMoin.Page.Page的用法示例。


在下文中一共展示了Page.getSubscribers方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: handle_file_attached

# 需要导入模块: from MoinMoin.Page import Page [as 别名]
# 或者: from MoinMoin.Page.Page import getSubscribers [as 别名]
def handle_file_attached(event):
    """Handles event sent when a file is attached to a page"""

    names = set()
    request = event.request
    page = Page(request, event.pagename)
    subscribers = page.getSubscribers(request, return_users=1)
    notification.filter_subscriber_list(event, subscribers, True)
    recipients = []

    for lang in subscribers:
        recipients.extend(subscribers[lang])

    attachlink = request.getQualifiedURL(getAttachUrl(event.pagename, event.filename, request))
    pagelink = request.getQualifiedURL(page.url(request, {}))

    for lang in subscribers.keys():
        _ = lambda text: request.getText(text, lang=lang)
        data = notification.attachment_added(request, _, event.pagename, event.filename, event.size)
        links = [{'url': attachlink, 'description': _("Attachment link")},
                  {'url': pagelink, 'description': _("Page link")}]

        jids = [usr.jid for usr in subscribers[lang]]
        data['url_list'] = links
        data['action'] = "file_attached"

        if send_notification(request, jids, data):
            names.update(recipients)

    return notification.Success(names)
开发者ID:IvanLogvinov,项目名称:soar,代码行数:32,代码来源:jabbernotify.py

示例2: handle_file_attached

# 需要导入模块: from MoinMoin.Page import Page [as 别名]
# 或者: from MoinMoin.Page.Page import getSubscribers [as 别名]
def handle_file_attached(event):
    """Sends an email to super users that have subscribed to this event type"""

    names = set()
    from_address = event.request.cfg.mail_from
    request = event.request
    page = Page(request, event.pagename)

    subscribers = page.getSubscribers(request, return_users=1)
    notification.filter_subscriber_list(event, subscribers, False)
    recipients = []

    for lang in subscribers:
        recipients.extend(subscribers[lang])

    attachlink = request.getBaseURL() + getAttachUrl(event.pagename, event.filename, request)
    pagelink = request.getQualifiedURL(page.url(request, {}))

    for lang in subscribers:
        emails = []
        _ = lambda text: request.getText(text, lang=lang)

        links = _("Attachment link: %(attach)s\n" \
                  "Page link: %(page)s\n") % {'attach': attachlink, 'page': pagelink}

        data = notification.attachment_added(request, _, event.pagename, event.filename, event.size)
        data['text'] = data['text'] + links

        emails = [usr.email for usr in subscribers[lang]]

        if send_notification(request, from_address, emails, data):
            names.update(recipients)

    return notification.Success(names)
开发者ID:steveyen,项目名称:moingo,代码行数:36,代码来源:emailnotify.py

示例3: notify_subscribers

# 需要导入模块: from MoinMoin.Page import Page [as 别名]
# 或者: from MoinMoin.Page.Page import getSubscribers [as 别名]
def notify_subscribers(macro, comment):
    '''Notify page subscribers'''
    subscribed_notify = get_cfg(macro, 'comment_subscribed_notify', False)
    if not subscribed_notify:
        return

    request = macro.request
    _ = macro.request.getText
    page = Page(request, comment['page'])
    subscribers = page.getSubscribers(request)

    mailing_list = []
    for lang in subscribers.keys():
        for person in subscribers[lang]:
            mailing_list.append(person)

    if mailing_list:
        sendmail.sendmail( request, mailing_list,
        _('New comment was posted in page %(page)s' % comment),
        _('New comment was posted in page:\n\nPage: %(page)s\nFrom: %(user_name)s\nMessage:\n\n%(comment)s\n\n--' %
        comment ))
开发者ID:wada314,项目名称:gswiki,代码行数:23,代码来源:comment_utils.py


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