tasks.py 文件源码

python
阅读 27 收藏 0 点赞 0 评论 0

项目:socialhome 作者: jaywink 项目源码 文件源码
def send_share(content_id):
    """Handle sending a share of a Content object to the federation layer.

    Currently we only deliver public shares.
    """
    try:
        content = Content.objects.get(id=content_id, visibility=Visibility.PUBLIC, content_type=ContentType.SHARE,
                                      local=True)
    except Content.DoesNotExist:
        logger.warning("No local share found with id %s", content_id)
        return
    entity = make_federable_content(content)
    if entity:
        if settings.DEBUG:
            # Don't send in development mode
            return
        recipients = _get_remote_followers(content.author)
        if not content.share_of.local:
            # Send to original author
            recipients.append((content.share_of.author.handle, None))
        handle_send(entity, content.author, recipients)
    else:
        logger.warning("send_share - No entity for %s", content)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号