示例#1
0
async def outbox_post(request, user):
    # TODO validate activity
    # TODO support mentions
    # TODO Accepts non-Activity Objects, and converts to Create Activities per 7.1.1
    # TODO merges audience properties (to, bto, cc, bcc, audience) with the Create's 'object's audience properties
    # TODO support collection

    activity = choose(user, request.json)
    await activity.save()
    await activity.deliver(debug=request.app.config.LOG_OUTGOING_REQUEST)

    return response.json({'peremoga': 'yep'},
                         status=201,
                         headers={'Location': activity.render["id"]})
示例#2
0
async def outbox_post(request, user):
    # TODO handle replies
    # TODO validate activity

    activity = choose(user, request.json)
    await activity.save()
    # for field in ["to", "cc", "bto", "bcc"]:
    #     if field in activity.render:
    #         recipients.extend(_to_list(activity.render[field]))
    recipients = await activity.recipients()

    # post_to_remote_inbox
    asyncio.ensure_future(deliver(user.key, activity.render, recipients))

    return response.json({'peremoga': 'yep'})
示例#3
0
async def outbox_post(request, user):
    # TODO validate activity
    # TODO support mentions
    # TODO Accepts non-Activity Objects, and converts to Create Activities per 7.1.1
    # TODO merges audience properties (to, bto, cc, bcc, audience) with the Create's 'object's audience properties
    # TODO support collection

    activity = choose(user, request.json)
    await activity.save()
    await activity.deliver(debug=request.app.config.LOG_OUTGOING_REQUEST)

    # TODO implement streaming
    # if activity.render["type"] == "Create":
    #     await request.app.streams.outbox.put(activity.render)

    return response.json({'Created': 'success'},
                         status=201,
                         headers={'Location': activity.render.get("id", '')})