

def invite_email(request, code):
    'User has received the invite email, and has followed the link to accept or\n     or refuse it.'
    if request.user:
        handled = common_views.handle_view_action(request, {
            'invite_accept': request.user.url('/overview'),
            'invite_reject': request.user.url('/overview'),
        })
        if handled:
            return handled
    invite = api.invite_get(api.ROOT, code)
    from_actor = invite.from_actor
    from_actor_ref = api.actor_get(api.ROOT, from_actor)
    view = from_actor_ref
    if (not from_actor_ref):
        return util.RedirectError('That invite is no longer valid')
    inbox = api.inbox_get_actor_contacts(api.ROOT, view.nick, limit=5)
    entries = api.entry_get_entries(api.ROOT, inbox)
    stream_keys = [e.stream for e in entries]
    streams = api.stream_get_streams(api.ROOT, stream_keys)
    actor_nicks = ((([view.nick] + [s.owner for s in streams.values() if s]) + [e.owner for e in entries]) + [e.actor for e in entries])
    actors = api.actor_get_actors(api.ROOT, actor_nicks)
    streams = display.prep_stream_dict(streams, actors)
    entries = display.prep_entry_list(entries, streams, actors)
    sidebar_green_top = True
    c = template.RequestContext(request, locals())
    t = loader.get_template('invite/templates/email.html')
    return http.HttpResponse(t.render(c))

dataset/ETHPy150Open CollabQ/CollabQ/invite/views.py invite_email/original