@contextfunction
def subscription_block(context, object):

    request = context['request']

    response_format = 'html'
    if 'response_format' in context:
        response_format = context['response_format']

    response_format_tags = response_format
    if 'response_format_tags' in context:
        response_format_tags = context['response_format_tags']

    subscriptions = object.subscribers.all()

    subscribed = False
    if request.user.profile in subscriptions:
        subscribed = True

    if 'subscribe_add' in request.GET and request.user.profile.has_permission(object, mode='w'):
        if request.POST and 'subscriber' in request.POST:
            if 'cancel' in request.POST:
                request.redirect = request.path
                return Markup(render_to_string('core/tags/subscription_block',
                                               {'object': object, 'subscriptions': subscriptions,
                                                'request': request, 'path': request.path,
                                                'subscribed': subscribed},
                                               context_instance=RequestContext(
                                                   request),
                                               response_format=response_format))
            else:
                form = SubscribeForm(object, request.POST)
                if form.is_valid():
                    subscriptions = form.save()

                request.redirect = request.path
                return Markup(render_to_string('core/tags/subscription_block',
                                               {'object': object, 'subscriptions': subscriptions,
                                                'request': request, 'path': request.path,
                                                'subscribed': subscribed},
                                               context_instance=RequestContext(
                                                   request),
                                               response_format=response_format))

        else:
            form = SubscribeForm(instance=object)

            context = {'object': object, 'subscriptions': subscriptions,
                       'request': request, 'path': request.path,
                       'subscribed': subscribed, 'form': form}

            if 'ajax' in response_format_tags:
                context = converter.preprocess_context(context)

            return Markup(render_to_string('core/tags/subscription_block_add', context,
                          context_instance=RequestContext(request),
                          response_format=response_format))

    if 'subscribe' in request.GET:
        if not subscribed:
            object.subscribers.add(request.user.profile)
            subscriptions = object.subscribers.all()
            subscribed = True
    elif 'unsubscribe' in request.GET and request.GET['unsubscribe']:
        user_id = int(request.GET['unsubscribe'])
        try:
            if request.user.profile.id == user_id or \
                    request.user.profile.has_permission(object, mode='w'):
                object.subscribers.remove(subscriptions.get(pk=user_id))
                subscriptions = object.subscribers.all()
                if user_id == request.user.profile.id:
                    subscribed = False
        except Exception:
            pass

    return Markup(render_to_string('core/tags/subscription_block',
                                   {'object': object, 'subscriptions': subscriptions,
                                    'request': request, 'path': request.path,
                                    'subscribed': subscribed},
                                   context_instance=RequestContext(request),
                                   response_format=response_format))
return an array of (TX ids, net_payment)
dataset/ETHPy150Open treeio/treeio/treeio/core/templatetags/object.py/subscription_block--crossover with--dataset/ETHPy150Open maraoz/proofofexistence/pycoin/services/blockchain_info.py/payments_for_address